javac - differences between classpath and sourcepath options

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-03-14T09:54:51Z Indexed on 2010/03/14 10:05 UTC
Read the original article Hit count: 291

Filed under:
|
|

Hi,

I read the Sun documentation and a lot of Q/A on SO but I'm still a little bit confuse regarding the differences between the javac options -cp and -sourcepath.

Let say I have this directory structure:
c:\Java\project1\src (where the .java source files are)
c:\Java\project1\bin (where the .class will be or are already)

The class source MainClass.java is in a package "com.mypackage" and the directory structure is ok in src.

I'm in the project1 directory. I run
c:\Java\Project1\javac -d bin -sourcepath src src/com/mypackage/MainClass.java
or
c:\Java\Project1\javac -d bin -classpath src src/com/mypackage/MainClass.java
and I obtain the same result. In verbose mode, the search path for source files is src in both cases.

If anybody could help me figure out the specifics of these options, it would be great.

Thank you.

© Stack Overflow or respective owner

Related posts about java

Related posts about command-line