Re: More class path
- From: Andy <andy@xxxxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 19:12:28 +0100
trixie wrote:
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
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
.
- References:
- More class path
- From: trixie
- More class path
- Prev by Date: More class path
- Next by Date: Re: JTable cell editing deselects row, workaround?
- Previous by thread: More class path
- Index(es):
Relevant Pages
|