Re: More class path



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
.



Relevant Pages

  • Re: Repost: Cancel stored procedure using JDBC
    ... I have a Java application that spawns 4 different threads. ... the database stops execution and replies with an error message. ... When JDBC does not receive an IOException, Oracle Net may eventually time out ... The server-side internal driver runs in the ...
    (comp.lang.java.programmer)
  • Re: JVM vs. EXE comaprison
    ... >> Startup time is added to the benchmark, and as such isnt measuring Java ... > The benchmark clearly is measuring Java execution performance. ...
    (comp.lang.java.programmer)
  • Re: To bean or not to bean
    ... With Java, you are pretty much stuck with OOP ... If you think of the top level class as part of the execution environment, ... instructions read in and executed one after the other. ... underscores, I don't get stung like that very often. ...
    (comp.lang.cpp)
  • Re: JVM vs. EXE comaprison
    ... >>> Startup time is added to the benchmark, and as such isnt measuring Java ... >> The benchmark clearly is measuring Java execution performance. ...
    (comp.lang.java.programmer)
  • Object initialization in C# thread - unexplained behaviour
    ... private AnotherObject an_obj; ... when a method is called on "objA" anywhere else it ... is a JNI wrapper for a Java class. ... began execution but then stopped for no apparent reason). ...
    (microsoft.public.dotnet.languages.csharp)