aspose file tools*
The moose likes Java in General and the fly likes Set system property from outside during runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Set system property from outside during runtime" Watch "Set system property from outside during runtime" New topic
Author

Set system property from outside during runtime

Lukas Stephienn
Ranch Hand

Joined: Dec 23, 2005
Posts: 60
Hi all,

Is there any possible way to set system property during runtime of virtual machine from outside world.

For example:
I start some app that will work for a long time. I start it with property -DmyProp=myVal.
While this app is working, I want to change myProp to "otherVal", but I don't want to do it from within app. I want to change that property from OS (or something like that) because I want to have possibility to set it on runtime, and I don't want to modify code of this app.

Can anybody say, is that possible?

Thanks in advance


SCJP 5.0 (91%), SCBCD 1.3 (94%), SCWCD 1.4 (88%)
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Nope, not possible, not without modifying the app. If you can modify the app, then you'd need to make it listen for input somehow, most likely on a Socket.


[Jess in Action][AskingGoodQuestions]
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
How about via debugging interface? These let an external program into the JVM, don't they?

Of course, a production Java program ought to have debugger interfaces turned off (mine do - I hope).


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
 
Don't get me started about those stupid light bulbs.
 
subject: Set system property from outside during runtime