• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there any difference between java.classpath and environment variable CLASSPATH??

 
Bhairava Surya
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Is there any difference between java.classpath and environment variable CLASSPATH??

because when I am executing a class


both are showind diff values. I ran this using eclipse.


Thanks & Regards,
Ravi.
 
Deepak Kumar Jena
Ranch Hand
Posts: 68
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The preferred way to extract system-dependent information is the system properties of the java.lang.System.getProperty methods and the corresponding getTypeName methods of the Boolean, Integer, and Long primitive types.
The signature of the method getenv is like this - public static String getenv(String name). To get get the value of the specified environment variable we need to pass the name of the variable as parameter. This method is deprecated since 1.3 because of bugs.
java.class.path is used to find directories and JAR archives containing class file.
 
Rob Spoor
Sheriff
Pie
Posts: 20613
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System.getProperty("java.class.path") includes paths added using the -classpath / -cp JVM argument (defaulting to . if you don't specify any). That does definitely not have to be the same as the environment variable.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic