permaculture playing cards
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes [SOLVED] javac -cp (multiple classpath) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "[SOLVED] javac -cp (multiple classpath)" Watch "[SOLVED] javac -cp (multiple classpath)" New topic

[SOLVED] javac -cp (multiple classpath)

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi Friends..

i'm wondering about how to set -cp in javac command for multiple classpath..

i'm working on windows, and assume that i've directory structure as bellow :

C:\MyDir\src //contains,,

this is the definition of each class :

I've compiled and and place it in its own bin directory..
I've placed B.class in C:\MyDir\bin
I've placed C.class in C:\MyDir\bin2

How to compile and then place it in C:\MyDir\bin directory?..

Thanks in advance..

Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Travis Hein
Ranch Hand

Joined: Jun 06, 2006
Posts: 161
in windows, use the delimiter for classpath is semicolin (;)

So specify each path to be used, maybe use quotes if the path has spaces in it.

And to have the javac placed into the output folder, the -d parameter to javac to have it output into the desired output folder

Or, you should be able to specify the -sourcepath "C:\MyDir\src" as well to have it know to look in the src folder.

It has been so long since I have done anything with javac, years ago I started using Ant, the XML build file makes sense as it saves a lot of time typing all that stuff in, it reduces the chances of me typing it in incorrectly, and it is cross platform .

Error: Keyboard not attached. Press F1 to continue.
Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489


Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

Leonardo Carreira wrote:

You have forget to import C class as well...

SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
I agree. Here's the link:
subject: [SOLVED] javac -cp (multiple classpath)
It's not a secret anymore!