Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying JVM arguments when calling a jar file?

I want to specify some JVM arguments when calling a jar file like so:

java -jar filename.jar 

I assumed I did it like so:

java -Xms256m -Xmx512m -Djava.awt.headless=true jar filename.jar 

But this doesn't seem to work. What am I doing wrong?

like image 693
Dominic Bou-Samra Avatar asked May 04 '11 23:05

Dominic Bou-Samra


People also ask

How do I run an argument from a JAR file?

Run a Nonexecutable JAR with Arguments To run an application in a nonexecutable JAR file, we have to use -cp option instead of -jar. We'll use the -cp option (short for classpath) to specify the JAR file that contains the class file we want to execute: java -cp jar-file-name main-class-name [args …]

Where are JVM parameters set?

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.


1 Answers

Do it like:

java -Xms256m -Xmx512m -Djava.awt.headless=true -jar filename.jar 
like image 109
CRM Avatar answered Oct 13 '22 19:10

CRM