This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

-sourcepath compilier option

 
Gerry Boicourt
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I encountered this with a larger set of files but it boils down to this.
I am using the command line jdk to compile java code. Specifically javac -version = 1.7.0_05

In the current directory called src I have a simple java class file called Earth.java:

public class Earth {
public Earth() {
System.out.println("Hello from Earth!");
}
}

If I compile using "javac Earth.java" it compiles fine.
Now I go "up" 1 directory by typing "cd .."
If I compile with the command "javac src\Earth.java" again it compiles fine.

Here's the rub. If while still in the directory above src I use the -sourcepath option and type:
"javac -sourcepath src Earth.java"

the compilier displays this message:
javac: file not found: Earth.java
Usage: javac <options> <source files>
use -help for a list of possible options

I assume this is a case of dumb user error but I vexed if I can figure out what I'm doing wrong.


 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
I am not sure that sourcepath is intended like that, but for finding classes which have already been compiled. But I am not sure. See whether the javac page makes it any clearer.
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your source file Earth.java have a package statement? If yes, what is it?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic