File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 42929
    
  68
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?
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: 42929
    
  68
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