Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2006

Tip: Looking for answers? Try searching our database.

More class path

Thread view: 
trixie - 29 Apr 2006 19:09 GMT
I have read the entries about class path and understand that you no longer
use the environment method to set the path and now you enter the path at the
execution of you application.
What I don't know is where should I point my class path?
My path to Java is:

C:\Program Files\Java\sdk1.5.0_06

What do I add to that?
I am running WinXP

Thanks Bob Wright
Andy - 29 Apr 2006 19:12 GMT
> I have read the entries about class path and understand that you no longer
> use the environment method to set the path and now you enter the path at the
[quoted text clipped - 6 lines]
> What do I add to that?
> I am running WinXP

Bob,

You can specify the classpath from the java executable using the -cp
switch. For example:
> java -cp somewhere MyProgram
Where somewhere is your classpath (holding classes) and MyProgram is the
java class you want to execute (the one with a static main method).

Where you 'point' your classpath depends on what classes & jars you want
 access to.

For example, within a particular projects directory, I create another
called class.
I compile everything like this:
> javac -d class MyProgram.java

This dumps the class files into the class directory. Then to run the
program I use this:
> java -cp class MyProgram

The benefit is that it keeps all the .class files away from your .java
source files. A bit tidier I reckon.

You can also use the -cp switch to include jars
> java -cp class:someJar.jar MyProgram.

Hope that helps, if not, perhaps provide a bit more info on what you are
trying to do.
Andy


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.