How to import?

Hi,There are 3 packages: A, B, C.B and C are sub packages of A: A.B and A.CIs there an possibility to import C in B or to change something in the compiler, so that it works fine?
[206 byte] By [betlora] at [2007-11-27 5:41:09]
# 1
What happened when you tried it yourself?
georgemca at 2007-7-12 15:18:17 > top of Java-index,Java Essentials,Java Programming...
# 2

Hi,

In case I try to import C in B, like import A.C.*;

it simply says package not found and does not compile. If i try it through the set method of the javac.exe it will also say: packe not found.

So is there any method how to import This package C in B, when C and B are subpackages of A

Message was edited by:

betlor

betlora at 2007-7-12 15:18:17 > top of Java-index,Java Essentials,Java Programming...
# 3

> Hi,

> In case I try to import C in B, like import

> A.C.*;

it simply says package not found and

> does not compile. If i try it through the set method

> of the javac.exe it will also say: packe not found.

>

> So is there any method how to import This package C

> in B, when C and B are subpackages of A

>

> Message was edited by:

> betlor

Yes, the way you're doing it. It's probably the way you're compiling. How are you compiling this, give details of the command, where you execute it from and the directory structure of your packages

georgemca at 2007-7-12 15:18:17 > top of Java-index,Java Essentials,Java Programming...
# 4

Hi,

The whole code is saved in C:, just like the javac. exe:

C:\A\B

C:\A\C

call of the javac.exe:

C:\Sun\AppServer\jdk\bin\javac.exe -g -cp "C:\A\C" -sourcepath "C:\A\B"

Is there any method how to change the code so that it works without changing something in the javac?

betlora at 2007-7-12 15:18:17 > top of Java-index,Java Essentials,Java Programming...
# 5
have u set the class path to c:\?just try to set the casspath is to C:then compile the codehop this helps
Littya at 2007-7-12 15:18:17 > top of Java-index,Java Essentials,Java Programming...
# 6
It still throws the same error: package not found. I guess in this case I have to reorganise my code.
betlora at 2007-7-12 15:18:17 > top of Java-index,Java Essentials,Java Programming...
# 7

> It still throws the same error: package not found. I guess in this case I

> have to reorganise my code.

I guess so too; always keep the directory structure where you store the

.class files identical to the directory structure where you store your .java

source files. Make the classpath point to the root directory where you

store the .class files and everything will be fine. Optionally set the

-sourcedir command line option to the root of your .java files.

kind regards,

Jos

JosAHa at 2007-7-12 15:18:17 > top of Java-index,Java Essentials,Java Programming...