This week's book giveaway is in the Design forum.
We're giving away four copies of Experimentation for Engineers: From A/B testing to Bayesian optimization and have David Sweet on-line!
See this thread for details.
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

[SOLVED] javac -cp (multiple classpath)

 
Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..

Thanks..
 
Ranch Hand
Posts: 400
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Leonardo Carreira wrote:



You have forget to import C class as well...
 
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic