Article View: borland.public.jbuilder.java.language
Article #8038Re: Compiling and Accessing Packages?
From: Joi Ellis [TeamB]
Date: Sun, 29 Apr 2001 03:12
Date: Sun, 29 Apr 2001 03:12
33 lines
1972 bytes
1972 bytes
hi <noneofyourbusiness@none.com> wrote: [snip] > To compile the package, I used this command: > D:\java\Animals\Dogs>javac -classpath D:\java TestDogs.java > and all the .class files for Poodle.java, Spaniel.java, and TestDogs.java > appeared in the folder D:\java\Animals\Dogs. Then I tried to access the > package from TestPackage.java in the D:\java\Chap5 directory: > D:\java\Chap5>javac -classpath .;D:\java\Animals\Dogs TestPackage.java [snip] > Then I tried this: > D:\java\Chap5>javac -classpath .;D:\java TestPackage.java > which seemed to compile because I got this: > D:\java\Chap5> > so, I entered: > D:\java\Chap5>java TestPackage > which gave me this output: > ================ > Exception in thread "main" java.lang.NoClassDefFoundError: > Animals/Dogs/Spaniel > at TestPackage.main(TestPackage.java:6) > ======================================== The command you use to run the code should be nearly identical to what you used to compile: java -classpath D:\java Animals.Dogs.TestPackage You don't need "." in your classpath at all. -- Joi Ellis (TeamB) No direct email, please. For best results, post on news server newsgroups.borland.com! Newsgroup Info: http://www.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<3aeb86a7_1@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mailReferences:
<3aeb6dd9_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,e13db2519d61bb0d
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-28 20:34:05 PST
Message-ID: <3aeb86a7_1@dnews>
From: "Joi Ellis [TeamB]" <joi@aravox.com>
Subject: Re: Compiling and Accessing Packages?
Newsgroups: borland.public.jbuilder.java.language
References: <3aeb6dd9_1@dnews>
User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.16-3 (i686))
NNTP-Posting-Host: 209.46.41.66
Date: 28 Apr 2001 20:12:40 -0700
X-Trace: dnews 988513960 209.46.41.66 (28 Apr 2001 20:12:40 -0700)
Lines: 33
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!not-for-mail