Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to modify JVM args using java code at runtime? [duplicate]

Possible Duplicate:
Modify JVM args from inside the JVM

I found an old question about this Modify JVM args from inside the JVM. It is asked 3.5 years ago. Wondering if it is possible now?

like image 302
DeepNightTwo Avatar asked Oct 14 '12 09:10

DeepNightTwo


People also ask

How do I edit JVM args?

Yes, right click the project. Click Run as then Run Configurations . You can change the parameters passed to the JVM in the Arguments tab in the VM Arguments box. That configuration can then be used as the default when running the project.

How do you change the JVM arguments in Minecraft?

Click Edit Profile and select a profile from the list. Enable JVM Arguments. In the "Java Settings (Advanced)" section, check the "JVM Arguments" box. This will allow you to enter commands to modify the Minecraft program.

How do you pass JVM arguments in STS?

Step 1: Open the IDE and right-click on the application in which you want to pass VM arguments. Step 2: Click on the Run As » Run Configurations… Step 3: Click on the Arguments tab and in the VM arguments: box, type the arguments that you want to pass.


2 Answers

Nope, it's still not possible to change JVM arguments at runtime. For most of the settings it most likely never will be possible either.

like image 167
Aleksander Blomskøld Avatar answered Oct 29 '22 14:10

Aleksander Blomskøld


In general no.

However there are some situations where you can change some specific configuration parameters at runtime, see e.g.:

  • http://fahdshariff.blogspot.sg/2011/08/changing-java-library-path-at-runtime.html

Still, it is probably a bad idea to try to change JVM args at runtime - they are designed for one-off configuration of the runtime environment. If you find yourself wanting to change JVM arguments at runtime, I suspect that there is something wrong with your design in the first instance and you should look at alternative ways to achieve your objective.

like image 21
mikera Avatar answered Oct 29 '22 14:10

mikera