diffrence in set classpath

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devgupta01
    New Member
    • Jan 2008
    • 20

    diffrence in set classpath

    i have a java program and needed class file is in jar file.
    i can compile that java program in three ways but i dont know what is difference between them. plz tell what is the difference between them.
    #1. javac Abc.java -classpath="need edJarFile.jar"

    #2. set classpath="need edJarFile.jar"
    javac Abc.java

    #3. set classpath="need edJarFile.jar"; .
    javac Abc.java

    >>>> Specially tell me what is difference b/w #2 and #3
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    We have to check what Sun, the root of all Java evil has to say about it; w.r.t.
    your first method, Sun says this:

    Originally posted by Sun
    The preferred way to specify the class path is by using the -cp command line switch. This allows the CLASSPATH to be set individually for each application without affecting other applications. Setting the CLASSPATH can be tricky and should be performed with care.
    The distinction between your second and third method is a bit more tricky, but
    Sun says this about it:

    Originally posted by Sun again
    Multiple path entries are separated by semi-colons. With the set command, it's important to omit spaces from around the equals sign (=).

    [ ... ]

    Classpath entries that are neither directories nor archives (.zip or .jar files) nor * are ignored.
    So there exists no trailing semicolon, i.e. the last entry is the empty string which
    is neither a directory nor an archive so it is ignored.

    kind regards,

    Jos

    Comment

    Working...