Monday, February 21, 2011

javac -classpath problem with multiple dirs

I have

c:\sources with

A.java
B.java
com\pluto\B.class
Test.java

and

c:\packages with

com\pluto\oth\C.class

in Test.java there are references to B and C (correctly imported) but when I try to compile with (I'm in c:\sources)

javac -classpath \.;c:\packages Test.java 

the compiler tell me that it doesn't find B

but if I move B.java from c:\sources to another dir and then I compile with

javac -classpath .;c:\packages Test.java 

it does work!!

How must I set the current dir? . or \. and why do the first test fail?

... it seems as the compiler doesn't want to find a class file com/pluto/B.class and a source file with the same name B.java in the current dir where I'm compiling...

From stackoverflow
  • Use . to refer to the current directory. \. refers to the root directory of the current drive (for example C:\).

    Dave.Sol : . or .\ to refer to the current directory
  • javac -classpath c:\sources;c:\packages Test.java
    
    xdevel2000 : it doesn't still work...
    FractalizeR : You need to list source files here. Something can be wrong there

0 comments:

Post a Comment