I am not clear about this. When I run a java App or run an Applet in applet viewer, (in the IDE environment), System.getProperty("java.class.path")
gives me the same as System.getenv("CLASSPATH")
which is the CLASSPATH defined in my env variable.
But when I deploy my applet to webserver and access it from the same computer as a client, I get different results for the two. (System.getProperty("java.class.path")
only points to JRE home and System.getenv("CLASSPATH")
returns null).
And here is some other things that make me wonder:
For the applet part, the env var JAVA_HOME, I get the same result when deploying the applet in a browser as well as Applet Viewer.
And if I define myself a env variable at system level, and use getenv("envName")
the result is null
. Is there anyway I can define one and get it in my Java program?
System properties include information about the current user, the current version of the Java runtime, and the character used to separate components of a file path name. The following table describes some of the most important system properties. Key. Meaning.
An environment variable is a dynamic "object" on a computer, containing an editable value, which may be used by one or more software programs in Windows. Environment variables help programs know what directory to install files in, where to store temporary files, and where to find user profile settings.
System environment variables are globally accessed by all users. User environment variables are specific only to the currently logged-in user.
Java™ system properties determine the environment in which you run your Java programs. They are similar to system values or environment variables in IBM® i. Starting an instance of a Java virtual machine (JVM) sets the values for the system properties that affect that JVM.
Environment variables are specific to the operating system. Properties are JVM only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With