Search code examples
javabatch-filelauncherlwjgl

I need a solution to starting Slick 2D/LWJGL Java project via command line. Help?


Currently I am starting my Slick 2D application via this batch file-

java -Djava.library.path=lib -Xms512m -Xmx512m -jar myapp.jar %1

Where lib is the folder that contains the LWJGL/Slick libraries and myapp.jar is my application.

Although this is easy and effective I want to be able not to have to run a script all the time and actually create a java .jar to do this.

So my question is, how would I 'convert' this batch script into Java code?


Solution

  • Any -D command line arguments can be set via java.lang.System.setProperty. But the memory parameters can't be set from inside a JVM as far as I know. Therefore, there is no way to do what you want.

    Instead you could generate e.g. a Windows executable with JSmooth. Such a wrapper should be able to set all JVM arguments. But in the end the situation is similar to the script. You have some kind of wrapper.