Search code examples
javajarexportjvm-arguments

How to pass arguments on the command line when launching JAR?


I'm trying to export my application to a JAR file. The program uses a lot of memory, so I used -Xmx1500m in Eclipse to make it work. It works when I export it (no errors), but it says VM arguments will not be part of the runnable JAR. How can I add the -Xmx1500m to my application outside of Eclipse? I tried a batch file with java -Xmx1500m but it didn't work. Any suggestions?


Solution

  • Try to use something like this:

      java -jar yourJarName.jar arg1 arg2