🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19290

Re: Parameters problem

#19290
From: John Catherino (remove xspamx to...
Date: Tue, 17 Feb 1998 00:00
42 lines
1970 bytes
Bertrand,

Parameters you wish to use in your application can be set in one of two
ways.

First, you can explicitly specify the property/value pairs on the command
line when invoking the Java interpreter.  This is done using the -D option.
Example:

    java -Dyourapp.property1=value1 -Dyourapp.property2=value2 yourapp

this will set two system properties, and then start your application.  Note:
your property values can be numbers, or strings, but if you want spaces in
your strings, you must put the string in quotes.

Second, and IMHO more practically, you can create a file of properties,
which can be loaded into the system properties at runtime.  The format of
the file is as follows:

# comment lines are preceded with the hash symbol
yourapp.property1=value1
yourapp.property2=value2

Note:  here value strings can have spaces, and do not need quotes.  The code
to merge the file into the system properties is as follows:

   Properties p = new Properties(System.getProperties());
   p.load(new BufferedInputStream(new FileInputStream(yourfile)));
   System.setProperties(p);

Note:  the second line has the possibility to throw a FileNotFoundException,
for obvious reasons.

In both cases, your application's additions to the system properties will
last only as long as your application runs.  There is no danger of the
system property list getting clogged up, like the Microsoft System Registry
does.

Good Luck,

John
Technical Details
Message-ID: <6cca4g$qb513@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34E84122.B22D500F@mx5ia21.ch.siemens.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,75382c95650b6d66
X-Google-Attributes: gidf74b3,public
From: "John Catherino (remove xspamx to reply)" <xspamx.johnc@rust.net>
Subject: Re: Parameters problem
Date: 1998/02/17
Message-ID: <6cca4g$qb513@forums.borland.com>
X-Deja-AN: 325892511
References: <34E84122.B22D500F@mx5ia21.ch.siemens.be>
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Organization: None
Newsgroups: borland.public.jbuilder.java.language