This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to System Property In application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to System Property In application" Watch "How to System Property In application" New topic
Author

How to System Property In application

Muhammad Umair Sheikh
Greenhorn

Joined: Mar 03, 2007
Posts: 3
Hello

I have a simple question that how can I set a System Property so that

it cant be accessible to the whole of my application.


Thanks in Advance to the Replier.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
Welcome to JavaRanch.

There is only a single set of system properties, and that is accessible to all parts of an application (unless you want to fiddle with security managers, and introduce specific Permission objects for some parts of the code).

Maybe you can create a separate Properties object, and pass that to those parts of the code that are allowed to access it?

What is the problem you're trying to solve by doing this?


Ping & DNS - updated with new look and Ping home screen widget
mohsen fakhari
Greenhorn

Joined: May 04, 2003
Posts: 25
Hi
there's a class may help you:
java.util.prefs.Preferences
In windows it manipulates registry,other OSs I don't know.

Maybe the easiest way is to set a static attribute.
Add one word and you've some properties accessibe all around your code while you import the class.
The trade off is however design issues.

Ofcourse you've some other strange ideas!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
there's a class may help you:
java.util.prefs.Preferences


But the Preferences API is accessible to all code in an application. How would you keep certain classes/packages from using it (without a security manager)?
mohsen fakhari
Greenhorn

Joined: May 04, 2003
Posts: 25
Hi
Unfortunately I hadn't seen 't' in 'cant'.
I assumed it is about accessing a parameter from all the code
Thank you Mr.Bartender!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to System Property In application
 
Similar Threads
JSSE
Adding entry to default system property.
How to set a custom logger property file in Tomcat?
how can i put configurations files outside war file
setting user.dir system property in JBoss 5.1