permaculture playing cards
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "javac sourcepath" Watch "javac sourcepath" New topic

javac sourcepath

Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
javac -d C:\projectsCC\ETL\xtract\adm\common\classes -sourcepath C:\projectsCC\ETL\xtract\adm\common\src com\ibm\esmrt\adm\common\

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

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

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

"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

Joined: Jul 08, 2003
Posts: 24199

-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\

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

[Jess in Action][AskingGoodQuestions]
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
Ah, I see. Thanks, Ernest.
I agree. Here's the link:
subject: javac sourcepath
It's not a secret anymore!