• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javac sourcepath

 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-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.
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I see. Thanks, Ernest.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic