This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
It's pretty simple. Just use the -sourcepath switch to specify where to find the source files.
For example: javac -sourcepath C:\Projects\MyProject\src -d C:\Projects\MyProject\bin com\example\HelloWorld.java
Actually, now that I investigated a bit more, you can't do this. -sourcepath only works for classes referenced by the source you're trying to compile. You still need to name the main class explicitly:
javac -sourcepath C:\Projects\MyProject\src -d C:\Projects\MyProject\bin C:\Projects\MyProject\src\com\example\HelloWorld.java
It's easier to just create a batch file in your project folder and do the following:
javac -cp src -d bin com\example\HelloWorld.java
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Joined: May 31, 2011
And better rename the folder java to say "source" to avoid confusion