473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to set properties without using -D

¤H
Normally we specify the properties for 'java' by the -D option. Is there
any alternatives, say reading a property file, rather than manually typing
all the properties one by one. I searched through the SDK documentation but
there wasnt anything mentioned.

I suspect there should be some ways. Any hints appreciated.
---
Posted via news://freenews.netfront.net
Complaints to ne**@netfront.net
Jul 17 '05 #1
1 4749
Try something like this. There is a line in "a.config" text file in
the directory where the program was started that contains
NewDraw3.version=1.0
this is standard keyword=value notation
(I edited out some code so I hope there are no typo's)
HTH
Phil...
-----------------------------------------------------------------
import java.util.Properties;
Properties useropt, sysProps;

sysProps = System.getProperties();
homeDir = sysProps.getProperty("user.dir", null);
// user properties
fn = "a.config"; // filename hardwired
useropt = new Properties();
configfile = new File(homeDir, fn);

try {
useropt.load(new FileInputStream(configfile));
} catch (IOException e) {
System.out.println("Warning -- config file not found -- ");
}
useropt.getProperty("NewDraw3.version","1.0");
-----------------------------------------------------------------
"¤H" <re****@hongkong.com> wrote in message news:bg**********@adenine.netfront.net...
Normally we specify the properties for 'java' by the -D option. Is there
any alternatives, say reading a property file, rather than manually typing
all the properties one by one. I searched through the SDK documentation but
there wasnt anything mentioned.

I suspect there should be some ways. Any hints appreciated.


---
Posted via news://freenews.netfront.net
Complaints to ne**@netfront.net

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Arno R | last post by:
Hi all, I have lots of properties in a class. (clsTest) Properties are created like (simplified ...) Public ItemA as string Public ItemB as string Public ItemC as string .... Public...
15
by: Gary Morris | last post by:
Hello all, OK, first of all I have known about properties since VB6, which I have and have used extensively. It seems that property get and set are basically the same concept in C# and VB.NET,...
4
by: Craig | last post by:
I'm trying to build a filter for a file search where the search will be able to filter out certain files according to certain "file properties", like Owner, Creation Date, etc. MS does this in...
45
by: Brett | last post by:
If I do this without declaring a corresponding field, is it considered bad design? What are the advantages or disadvantages to either method? Notice there is not set. public string URL { get...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
2
by: mgoold2002 | last post by:
Hello. I've just begun programming in VB .NET, and I'm trying to turn all my modules into classes. In order to retrieve/exchange values from one class to another, I initiated New instances of the...
47
by: Jon Slaughter | last post by:
private string name; public string Name { get { return name; } set { name = value; } } In the above, why doesn't C# just allow one to create a single directive to make a property?
13
by: Dave | last post by:
When using the properties designer to store application wide properties how do you get this to work across a project group containing an EXE and a collection of DLLs. I'm using C#.Net 2005. I...
5
by: Sergio Montero | last post by:
I have a MustInherits Base class that implements a custom IDataLayer interfase. IDataLayer expose CRUD methods. Base class constructor requires two parameters: ConnectionString TableName ...
17
by: David C. Ullrich | last post by:
Having a hard time phrasing this in the form of a question... The other day I saw a thread where someone asked about overrideable properties and nobody offered the advice that properties are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.