I read the Sun documentation and a lot of posts on Stack Overflow, but I'm still confused about the differences between the Java compiler options -cp
and -sourcepath
.
Let say I have this directory structure:
c:Javaproject1src (where the Java source files are)
c:Javaproject1in (where the Java class files will be or already are)
Let's also say I have a source file MainClass.java
in a package com.mypackage
, and that the directory structure is ok in the source folder.
I'm in the project1 directory and run:
javac -d bin -sourcepath src src/com/mypackage/MainClass.java
or
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.
It would be great if anybody could help me figure out the specifics of these options.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…