Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Where are Java System Properties stored?

2,465 views
Skip to first unread message

Jiong Tang

unread,
May 20, 2003, 10:50:41 AM5/20/03
to
I have a very simple program to list the system properties being set.

import java.util.Properties;

public class myProp
{
public static void main( String argv[] )
{
Properties myProps = System.getProperties();
myProps.list( System.out );
}
}

It gives me a quite long list. But I am wondering where do they come from?
Are they stored somewhere in a file and etc?

-- listing properties --
java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=C:\j2sdk1.4.1\jre\bin
java.vm.version=1.4.1-b21
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.country=US
sun.os.patch.level=Service Pack 2
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:\jwsdp-1.1\docs\tutorial\examples\j...
java.runtime.version=1.4.1-b21
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C:\j2sdk1.4.1\jre\lib\endorsed
os.arch=x86
java.io.tmpdir=D:\Profiles\xyzt\LOCALS~1\Temp\
line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows 2000
sun.java2d.fontpath=
java.library.path=C:\j2sdk1.4.1\jre\bin;.;C:\WINNT\Syst...
java.specification.name=Java Platform API Specification
java.class.version=48.0
java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferenc
os.version=5.0
user.home=D:\Profiles\xyz
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=Cp1252
java.specification.version=1.4
user.name=XYZ
java.class.path=./
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=C:\j2sdk1.4.1\jre
java.specification.vendor=Sun Microsystems Inc.
user.language=en
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.4.1
java.ext.dirs=C:\j2sdk1.4.1\jre\lib\ext
sun.boot.class.path=C:\j2sdk1.4.1\jre\lib\endorsed\dom.ja...
java.vendor=Sun Microsystems Inc.
file.separator=\
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.cpu.isalist=pentium i486 i386


Thomas Weidenfeller

unread,
May 20, 2003, 11:13:50 AM5/20/03
to
"Jiong Tang" <jio...@nortelnetworks.com> writes:
> It gives me a quite long list. But I am wondering where do they come from?
> Are they stored somewhere in a file and etc?

Usually not. They are set by the VM implementation, which obtains the
values in many ways (environment, OS system calls, etc.). A lot of
them are most likely even hard-coded in the VM code.

Very few of them can be changed on the command line when starting the
Java VM, via their own command line options. Using -D to change them is
usually not a good idea. Most of them are not meant to be changed.

/Thomas

Roedy Green

unread,
May 20, 2003, 11:15:48 PM5/20/03
to
On Tue, 20 May 2003 10:50:41 -0400, "Jiong Tang"
<jio...@nortelnetworks.com> wrote or quoted :

>It gives me a quite long list. But I am wondering where do they come from?
>Are they stored somewhere in a file and etc?

They are not stored. They are generated by a native method.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/iraq.html for links about the Iraq war.

khushank...@gmail.com

unread,
Apr 21, 2015, 3:52:40 AM4/21/15
to
Hi,
For the above query i wanted to know whether i can access the system property explicitly through following code:
Properties p = System.getProperties();
p.put("check_value", "true");
System.setProperties(p);

now the property is returning null when i access it in different process/application with
System.getProperty("check_value").

is there any way by which we can set the system property which is accessible to all the processes

Joerg Meier

unread,
Apr 21, 2015, 6:12:08 AM4/21/15
to
On Tue, 21 Apr 2015 00:52:37 -0700 (PDT), khushank...@gmail.com wrote:

> For the above query i wanted to know whether i can access the system property explicitly through following code:
> Properties p = System.getProperties();
> p.put("check_value", "true");
> System.setProperties(p);

> now the property is returning null when i access it in different process/application with
> System.getProperty("check_value").

> is there any way by which we can set the system property which is accessible to all the processes

That is not possible in Java. Your only solution as far as I know is to
call an external program, such as the system shell, and use that to set
environment variables. Java only holds a copy of the properties, so no
matter what tricks you try, you will not be able to affect the outside
world.

Liebe Gruesse,
Joerg

--
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.
0 new messages