• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

[SOLVED] javac -cp (multiple classpath)

 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 A.java, B.java, C.java
C:\MyDir\bin
C:\MyDir\bin2

this is the definition of each class :






I've compiled B.java and C.java 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 A.java and then place it in C:\MyDir\bin directory?..

Thanks in advance..
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

Thanks..
 
Ranch Hand
Posts: 400
Hibernate Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Leonardo Carreira wrote:



You have forget to import C class as well...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic