Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9342
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.11.MISMATCH!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!v33g2000prm.googlegroups.com!not-for-mail |
|---|---|
| From | KevinSimonson <kvnsmnsn@hotmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Why Doesn't my Code Work with this Jar File? |
| Date | Tue, 1 Nov 2011 10:39:25 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 91 |
| Message-ID | <ae31e352-678a-47ae-ae12-86bd4be88413@v33g2000prm.googlegroups.com> (permalink) |
| NNTP-Posting-Host | 216.49.181.254 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1320170820 3414 127.0.0.1 (1 Nov 2011 18:07:00 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Tue, 1 Nov 2011 18:07:00 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | v33g2000prm.googlegroups.com; posting-host=216.49.181.254; posting-account=gsXmKQkAAADuyNfZpkeBrCCcqQvlDvn9 |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-Header-Order | ARLUEHNKC |
| X-HTTP-UserAgent | Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; InfoPath.2; .NET4.0E; .NET4.0C),gzip(gfe) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9342 |
Show key headers only | View raw
I'm having a nasty time figuring out how to use JAR files. I have a
directory "Jrs" that includes an "abc" directory and a "def"
directory. In directory "abc" I have a single file called
"AbcCl.java" coded:
package abc;
public class AbcCl
{
public String toString ()
{
return "[AbcCl Object]";
}
}
and in directory "def" I have a single file called "DefCl.java" coded:
package def;
public class DefCl
{
public String toString ()
{
return "[DefCl Object]";
}
}
Back in "Jrs" I have a file "UseEm.java" coded:
import abc.AbcCl;
import def.DefCl;
public class UseEm
{
public static void main ( Strin[] arguments)
{
AbcCl ac = new AbcCl();
DefCl dc = new DefCl();
System.out.println( "ac == " + ac + ", dc == " + dc + '.');
}
}
Then I executed "javac UseEm.java", which created three class files,
an "abc\AbcCl.class", a "def\DefCl.class", and a "UseEm.java".
Finally I created two jar files with commands "jar -cf abc.jar abc"
and "jar -cf def.jar def".
Then I created a "Jrs2" directory, a sibiling to "Jrs", and copied to
it "UseEm.java" and the two JAR files. In that "Jrs2" directory I
typed in the command "javac -cp abc.jar:def.jar", and as a result got
a whole bunch of error messages. I was kind of expecting that.
At that point I typed in "jar -xf abc.jar" which extracted the "abc"
directory, and I thought that therefore I should be able to compile
"UseEm.java" with the command "javac -cp .:def.jar UseEm.java". But
when I tried it I got error messages:
UseEm.java:1: package abc does not exist
import abc.AbcCl;
^
UseEm.java:2: package def does not exist
import def.DefCl;
^
UseEm.java:8: cannot find symbol
symbol : class AbcCl
location: class UseEm
AbcCl ac = new AbcCl();
^
UseEm.java:8: cannot find symbol
symbol : class AbcCl
location: class UseEm
AbcCl ac = new AbcCl();
^
UseEm.java:9: cannot find symbol
symbol : class DefCl
location: class UseEm
DefCl dc = new DefCl();
^
UseEm.java:9: cannot find symbol
symbol : class DefCl
location: class UseEm
DefCl dc = new DefCl();
^
6 errors
Does anybody have any idea what I'm doing wrong? Why can't I get the
code I need to compile out of this JAR file? And _why in the world_
can't my compiler see the <AbcCl> class? The "abc" directory is
_right there_, with an "AbcCl.class" and an "AbcCl.java" file right in
it?
Kevin Simonson
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Why Doesn't my Code Work with this Jar File? KevinSimonson <kvnsmnsn@hotmail.com> - 2011-11-01 10:39 -0700
Re: Why Doesn't my Code Work with this Jar File? markspace <-@.> - 2011-11-01 11:23 -0700
Re: Why Doesn't my Code Work with this Jar File? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-01 20:21 -0300
Re: Why Doesn't my Code Work with this Jar File? Lew <lewbloch@gmail.com> - 2011-11-01 16:59 -0700
Re: Why Doesn't my Code Work with this Jar File? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-01 22:14 -0400
Re: Why Doesn't my Code Work with this Jar File? Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-11-02 07:13 -0300
Re: Why Doesn't my Code Work with this Jar File? KevinSimonson <kvnsmnsn@hotmail.com> - 2011-11-02 16:44 -0700
Re: Why Doesn't my Code Work with this Jar File? markspace <-@.> - 2011-11-02 18:16 -0700
Re: Why Doesn't my Code Work with this Jar File? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-02 20:00 -0400
Re: Why Doesn't my Code Work with this Jar File? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-03 00:47 -0700
Re: Why Doesn't my Code Work with this Jar File? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-03 00:50 -0700
csiph-web