This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Why javac does not find this Java file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Why javac does not find this Java file?" Watch "Why javac does not find this Java file?" New topic
Author

Why javac does not find this Java file?

Rashid Mian
Ranch Hand

Joined: Feb 14, 2007
Posts: 31
Here is the director structor I am using to compile a java sourse

1- C:\src\b\A.java
2- C:\classes


when I use the following command to compile A.java I does not find it.

C:\>javac -sourcepath src -d classes A.java
OR
C:\>javac -sourcepath src -d classes b/A.java
Why it can't find that source file?
What I want is it to find source file using above position only, Means I don't want to go to src folder like this

C:\src>javac b/A.java -d ..\classes
Priya Viswam
Ranch Hand

Joined: Dec 28, 2006
Posts: 81
Source path is used to tell the compiler where to find sources it needs that aren't specified on the command line.


http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4984204


SCJP 1.5<br />SCWCD 1.4
Rashid Mian
Ranch Hand

Joined: Feb 14, 2007
Posts: 31
I did not understand it, please give me example in my context
Priya Viswam
Ranch Hand

Joined: Dec 28, 2006
Posts: 81
In the example you quoted , sourcepath doesn't have any role as it is not referring to any other java files.

If A.java have any reference to other java file which is placed in some other directory, we can use sourcepath to specifiy where to find the referenced file.


for eg:


Here A.java is referencing Test class which is located in C:\src\second\Test.java. We can compile A.java file using the command

C:\src>javac -sourcepath . b\A.java
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why javac does not find this Java file?