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 > How to include ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 16026 of 16069
Post > Topic >>

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

by ulf2m@[EMAIL PROTECTED] (Ulf Meinhardt) Apr 26, 2008 at 03:17 PM

Assume I have an already compiled java class in the following location:

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>

I want to compile another java class test.java which uses the class
myclass e.g. in a statement like

myclass dummy = new myclass();

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:

test.java:22: cannot access myclass
bad class file: D:\java\output\aaa\bbb\ccc\myclass.class
class file contains wrong class: aaa.bbb.ccc.myclass
Please remove or make sure it appears in the correct subdirectory of the
classpath.
          myclass dummy = new myclass();
          ^
1 error

Why?

I added D:\java\output\aaa\bbb\ccc to the CLASSPATH. Shouldn't that be
sufficient?

Ulf




 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 Sun May 11 18:45:16 CDT 2008.