Inspect CLASSPATH inside the JVM

Discussion in 'Java' started by ps2rox@gmail.com, May 2, 2006.

  1. Guest

    Is possible to get the CLASSPATH using Java commands?

    Blablabla.getClasspath() or something like this...

    Thanks in advance.

    Paulo Silvestre Schmitt.
     
    , May 2, 2006
    #1
    1. Advertising

  2. schrieb:
    > Is possible to get the CLASSPATH using Java commands?
    >
    > Blablabla.getClasspath() or something like this...
    >
    > Thanks in advance.
    >
    > Paulo Silvestre Schmitt.
    >

    The system-Property "java.class.path" contains the classpath.
    Inside a jar this wont work, because the class-path defined
    in the manifest is not set.
    Perhaps you can find some info from the current ClassLoader?

    Best regards,

    feri
     
    Ferenc Hechler, May 2, 2006
    #2
    1. Advertising

  3. Tony Morris Guest

    "Ferenc Hechler" <> wrote in message
    news:4457ad54$0$4493$-online.net...
    > schrieb:
    >> Is possible to get the CLASSPATH using Java commands?
    >>
    >> Blablabla.getClasspath() or something like this...
    >>
    >> Thanks in advance.
    >>
    >> Paulo Silvestre Schmitt.
    >>

    > The system-Property "java.class.path" contains the classpath.
    > Inside a jar this wont work, because the class-path defined
    > in the manifest is not set.
    > Perhaps you can find some info from the current ClassLoader?
    >
    > Best regards,
    >
    > feri


    It will most definitely work - whether or not this meets the objective is
    another matter.
    Calling System.property("java.class.path") will always return the
    java.class.path system property, regardless of any VM invocation properties.

    --
    Tony Morris
    http://tmorris.net/
     
    Tony Morris, May 2, 2006
    #3
  4. Tony Morris schrieb:
    > Calling System.property("java.class.path") will always return the
    > java.class.path system property, regardless of any VM invocation properties.

    this is true, but if you write a manifest
    containing "Class-Path: lib/abc.jar config/" and start the jar using
    "java -jar my.jar" the java.class.path property is empty, thogh the
    lib/abs.jar is loaded and config-files in config/ are found.
    Which means the Jar-File Class-Loader does not only
    look in the java.class.path

    Best regards,

    feri
     
    Ferenc Hechler, May 4, 2006
    #4
  5. wpghost Guest

    This is exactly what I need.
    Thank you guys!
     
    wpghost, May 8, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Flip
    Replies:
    3
    Views:
    7,280
    Tony Morris
    Feb 9, 2004
  2. Gabe
    Replies:
    3
    Views:
    1,078
  3. Replies:
    2
    Views:
    756
  4. Replies:
    2
    Views:
    1,113
    Mike Schilling
    Mar 2, 2008
  5. deluxstar
    Replies:
    5
    Views:
    868
    Terry Reedy
    Sep 25, 2010
Loading...

Share This Page