File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes -sourcepath compilier option Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "-sourcepath compilier option" Watch "-sourcepath compilier option" New topic
Author

-sourcepath compilier option

Gerry Boicourt
Greenhorn

Joined: Feb 21, 2013
Posts: 1
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

Joined: Oct 13, 2005
Posts: 39478
    
  28
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

Joined: Jul 27, 2010
Posts: 1157

Does your source file Earth.java have a package statement? If yes, what is it?


~ Mansukh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: -sourcepath compilier option