Is there a way to enable the VM option inside .jar?

I have a game implemented in Java that has a problem when running too much code from scripts: depending on the script language, the game may have these "hiccups" where the game will depend on a couple of frames each time and then, making the game " sluggish "from time to time.

After some research, I found this to happen when the garbage collector decided to run. After some research and testing, I found that using the incremental garbage collector (using the VM-VM parameter) fixes the problem. Yes, I know that the GC runs about 10% slower, but this is the cost I pay.

With this background information, now what I want to do is a .jar game package, as I have done so far, but I don’t know how to make the application use incremental GC without using -Xincgc, and I did not want to create .bat files /.sh, where before the user just had to double-click the .jar icon.

Is there a way to make .jar run with incremental GC without requiring any loader (.bat / .sh) or wrapper around it? Is there a way to enable this option in .jar?

+3
source share
6 answers

No, there is no way to do this. VM arguments can only be provided as command line parameters for invoking the JVM: Java Tool

+5

JNLP, , .

+3

jar . Java WebStart java- VM. Launch4J, . exe, linux windows. Linux.

+1

java- coorporate dev, , . . Fancier, exe, ... Windows, Linux.

0

Java Web Start, JSMooth. EXE, , , JVM - .

0

- - jar Runtime.exec(), ? , .

0

Source: https://habr.com/ru/post/1712349/


All Articles