Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Help > Re: How to incl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 8 Topic 16026 of 16085
Post > Topic >>

Re: How to include *.class file with package in CLASSPATH?

by Lion-O <nosp@[EMAIL PROTECTED] > Apr 26, 2008 at 10:26 AM

On 2008-04-26, Ulf Meinhardt <ulf2m@[EMAIL PROTECTED]
> wrote:

> D:\java\output\aaa\bbb\ccc\myclass.class
>
> myclass.java contains the following package information:
>
> package aaa.bbb.ccc;
>
> The current path in the command prompt is
>
> D:\java>

---<CUT

> But when I enter a statement like:
>
> javac -cp D:\java\output\aaa\bbb\ccc;%CLASSPATH% test.java
>
> then the compiler complains that he cannot find myclass:

Try thinking of packages being directories when you're working on the
commandline. You already seem to be doing that since you've setup a
directory
structure aaa\bbb\ccc. Now, in order to find the classes in the package
the
compiler expects to be able and access a directory structure aaa\bbb\ccc
which
then contains myclass.class.

But your classpath doesn't have that, it only points to the directory
where
myclass.class resides but that directory doesn't contain the actual
directory
structure.

Try just compiling without setting any classpath, or, if your classpath
contains specific settings try: javac -cp .;%CLASSPATH test.java


Groetjes, Peter

-- 
..\\ PGP/GPG key: http://www.catslair.org/pubkey.asc




 8 Posts in Topic:
How to include *.class file with package in CLASSPATH?
ulf2m@[EMAIL PROTECTED]   2008-04-26 15:17:50 
Re: How to include *.class file with package in CLASSPATH?
Lion-O <nosp@[EMAIL PR  2008-04-26 10:26:02 
Re: How to include *.class file with package in CLASSPATH?
Lew <lew@[EMAIL PROTEC  2008-04-26 22:03:53 
Re: How to include *.class file with package in CLASSPATH?
=?ISO-8859-1?Q?Arne_Vajh=  2008-04-26 11:33:48 
Re: How to include *.class file with package in CLASSPATH?
Roedy Green <see_websi  2008-04-27 10:44:42 
Re: How to include *.class file with package in CLASSPATH?
Joshua Cranmer <Pidgeo  2008-04-27 22:16:50 
Re: How to include *.class file with package in CLASSPATH?
CHAFIK Wassime <wassim  2008-04-28 17:12:48 
Re: How to include *.class file with package in CLASSPATH?
evan <evan.e.thomas@[E  2008-04-29 16:08:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 5:19:06 CDT 2008.