Error executing: java -Xms512M -Xmx1024M - java

$ java -Xms512M -Xmx1024M
While running the above command I got the error below. Please help me how to set JVM Heap memory in AIX box. Here I'm using java 5.
Usage: java [-options] class [args...]
(to execute a class) or java -jar [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by :>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-showversion print product version and continue
-? -help print this help message
-X print help on non-standard options

Well, you have to execute SOME java program, not just the JVM. The options itself are fine. Try java -Xms512M -Xmx1024M -cp somejar.jar mystuff.Main or something.

What about export JAVA_OPTS="-Xms512M -Xmx1024M" (unix) or set JAVA_OPTS=-Xms512M -Xmx1024M (windows)?

Try This also :
java -Xms512M -Xmx1024M -classpath jar1.jar:jar2.jar packageName.YourMainClassName Arguments

Related

Sopaui git jenkins integration

Hi I am using below code in build step in jenkin
#!/bin/bash
pwd
cd ./eclipse-workspace/SoapUiTest
pwd
javac -classpath "lib/* -d ./bin ./src/defaultPackage/*.java"
java -cp "bin;lib/* org.testng.TestNG testng.xml"
while running job i am getting below error
javac: no source files
Usage: javac
use -help for a list of possible options
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
-zero to select the "zero" VM
-dcevm to select the "dcevm" VM
The default VM is server,
because you are running on a server-class machine.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
An obvious error is the mixure of flags in flag values in javac command:
#!/bin/bash
pwd
cd ./eclipse-workspace/SoapUiTest
pwd
javac -classpath "lib/*" -d "./bin" "./src/defaultPackage/*.java"
java -cp "bin;lib/* org.testng.TestNG testng.xml"
javac command explanation: you specify where to find additional class binaries that the compilation depends on, where to output the compiled files and finally where to read the sources from.

How To add some arguments into JVM? [duplicate]

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?
Do it like:
java -Xms256m -Xmx512m -Djava.awt.headless=true -jar filename.jar
java [Options] -jar [jarfile] [Command Line Arguments]
Please refer
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html
Don't put a space between the -D and java.awt.headless=true.
It should be -Djava.awt.headless=true.
hype jar was missing , try
java -Xms256m -Xmx512m -Djava.awt.headless=true -jar

How to put '-XX:+UseG1GC -Xmx1g -Xms512m' parameters for a .jar in the service wrapper?

I have a jar named my-app-0.0.1-SNAPSHOT.jar. I have to pass -XX:+UseG1GC -Xmx1g -Xms512m to the jar like
sudo java -XX:+UseG1GC -Xmx1g -Xms512m -jar my-app-0.0.1-SNAPSHOT.jar
I've created the .sh using above command. I use this single line bash script file in my-app.service to execute the .jar. Now I need to put everything in .service file. No .sh in picture. How to put those in the .service file? Any help is appreciated.

Set heap size for -jar command

I want to set heap size under Linux OS in order to use it on java -jar command.
I have tried to add _JAVA_OPTIONS property under .bash_profile, but this property is ignored. I know I can run my jar with
java $_JAVA_OPTIONS -jar
command or create an alias like
alias java='java -Xms256m -Xmx512m'
I have found I can also export _JAVA_OPTIONS:
export _JAVA_OPTIONS="-Xms256m -Xmx512m"
But this property is not kept between sessions.
Any idea how can I set permanent heap size for java -jar command?

Running jar via code- Java

final String dir = "C:\\Users\\theo\\Desktop\\1.6 test\\craftbukkit.jar";
Process proc = Runtime.getRuntime()
.exec("java -Xmx1024M -jar "+ dir +" -o true PAUSE");
So.I did some research around here but this thing apparently is not working/running the JAR file.
Note the space in the path of the jar. This means, in the command you build up it will be seen as two arguments:
java -Xmx1024M -jar C:\Users\theo\Desktop\1.6 test\craftbukkit.jar -o true PAUSE
Try to quote the path to build a command like this:
java -Xmx1024M -jar "C:\Users\theo\Desktop\1.6 test\craftbukkit.jar" -o true PAUSE
You need to provide the full path to the Java executable, not just 'java'.
Assuming the program in question is well-behaved, you could use reflection to invoke the main method on the jar's main class without starting up a new JVM.

Categories

Resources