aspose file tools*
The moose likes Beginning Java and the fly likes javac sourcepath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "javac sourcepath" Watch "javac sourcepath" New topic
Author

javac sourcepath

Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
javac -d C:\projectsCC\ETL\xtract\adm\common\classes -sourcepath C:\projectsCC\ETL\xtract\adm\common\src com\ibm\esmrt\adm\common\Conductor.java

I expect that if I'm sitting in a directory
C:\java
and type this command, it will look in C:\projectsCC\ETL\xtract\adm\common\src for com\ibm\esmrt\adm\common\Conductor.java and I'll find the Conductor.class file here C:\projectsCC\ETL\xtract\adm\common\classes\com\ibm\esmrt\adm\common\Conductor.class

but
I'm getting
error: cannot read: com\ibm\esmrt\adm\common\Conductor.java
(it doesn't work with dots either
error: cannot read: com.ibm.esmrt.adm.common.Conductor.java)

What am I doing wrong? How can I compile this without going into the src directory?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

-sourcepath tells javac where to find other source files, besides the ones you specify on the command line. Those you have to be explicit about. So

javac -d C:\projectsCC\ETL\xtract\adm\common\classes -sourcepath C:\projectsCC\ETL\xtract\adm\common\src C:\projectsCC\ETL\xtract\adm\common\src\com\ibm\esmrt\adm\common\Conductor.java

will work, and it will find any source files that Conductor.java depends on. Without -sourcepath, this command would fail unless Conductor.java had no dependencies.


[Jess in Action][AskingGoodQuestions]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Ah, I see. Thanks, Ernest.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javac sourcepath