Here I have a command line to start a jarfile.
And it is correct and was able to start my application.jar file.
nohup java -jar -Xms512M -Xmx512M -Xmn300M -XX:SurvivorRatio=6 -Dspring.profiles.active=test /data/code/application.jar >> /data/code/logs/application.log &
When I tried to add metaspace parameters ‐XX:MetaspaceSize=256M ‐XX:MaxMetaspaceSize=256M into my start-up-command, which is showing below:
nohup java -jar -Xms512M -Xmx512M -Xmn300M -XX:SurvivorRatio=6 ‐XX:MetaspaceSize=256M ‐XX:MaxMetaspaceSize=256M -Dspring.profiles.active=test /data/code/application.jar >> /data/code/logs/application.log &
the JVM crashed with logError: Unable to access jarfile ‐XX:MetaspaceSize=256M.
Is there any thing that I missed? It seems that JVM not recognizing metaspace parameters in commandline, and treated it as an illegal jarfile.
The jdk version by java -version is showing below:
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
My bad, copy from google but never check the words,- was a wrong word(not in English) which leads to the error. Just type it manually again in English, the problem solved.....
Related
im using a VM with minimal installed CentOS 7. Im quite new with linux and CentOs. My Java version:
java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
When I try running a java based application (a .exe) I get the following error, this Java application should be running with Java8, in fact it was running last time the VM was on (last friday) today (sunday) when a turned on again it gives the error:
Invalid maximum heap size: -Xmx1g
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I tried the following commands:
java -Xmx1024M -Xms1024M
result of above command
and
java -Xmx2048M -d64
results of the second command
But as you see I only get some java usage text, and the problem persists.
Also tried to add into .bash_profile the line. Again with no success.
export _JAVA_OPTIONS=-Xmx2g
Updating.
Hello, it worked after a reinstalled the app, and with the export _JAVA_OPTIONS=-Xmx2g on .bash_profile.
So I have a jar file that has been built as an artifact from Intellij IDEA and I want to be able to run it with javaw so that the console is not visible.
I think that this should work, but for some reason it spits out a JNI error.
"C:\Program Files (x86)\Common Files\Oracle\Java\javapath\javaw.exe" -jar my.jar -Xms1024m -Xmx1024m -cp "my.jar;my_lib/*" nz.co.aaa.my.ui.MainForm
Same happens with
javaw -jar ftExoWebManager.jar -Xms1024m -Xmx1024m -cp "my.jar;my_lib/*" nz.co.aaa.my.ui.MainForm
The below command does work and program runs fine but it shows the console window.
java -cp "my.jar;my_lib/*" nz.co.aaa.my.ui.MainForm
The only version of java installed is Oracle Java 1.8.0_191
java -showversion
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
Any thoughts on how to accomplish this, do I need to install a different java version to fix javaw or change something obscure in the Java programs code?
Thanks.
I'm attempting to use spacemacs, elipse and eclimd for editing with autocompletion. However, eclimd is attempting to start the java server with the -command ping option. My version of Java does not support that option. I have been unable to find this option in the documentation. Is it deprecated? Which version of Java supports it?
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
/usr/lib/jvm/java-8-oracle/bin/java -d64 -command ping -Dosgi.requiredJavaVersion=1.8 -Dosgi.instance.area.default=#user.home/eclipse-workspace -XX:+UseG1GC -Dosgi.dataAreaRequiresExplicitInit=true -Xms256m -Xmx1024m -jar /snap/eclipse/current/plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar --launcher.suppressErrors -debug -clean -refresh -application org.eclim.application
Unrecognized option: -command
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
No version of Java supports -command.
That option is supposed to be an argument for eclim, not for java
eclim -command ping
or presumably something like
java -d64 -Dosgi.requiredJavaVersion=1.8 -Dosgi.instance.area.default=#user.home/eclipse-workspace -XX:+UseG1GC -Dosgi.dataAreaRequiresExplicitInit=true -Xms256m -Xmx1024m -jar /snap/eclipse/current/plugins/org.eclipse.equinox.launcher_1.5.0.v20180512-1130.jar --launcher.suppressErrors -debug -clean -refresh -application org.eclim.application -command ping
Either you've configured something wrong, or something has a bug.
There is no -cmd.
But maybe you are talking about a new feature in Java 11. You can now do:
java HelloWorld.java
Meaning: when you have a "single file class", with a main method, you can sidestep invoking javac first, to then run java with the class name. Instead, you can do the above and directly "run+compile" a .java file.
That feature was added with JEP 330.
I start and attach a docker container, but nothing working after setting JDK.
Docker container didn’t work after the command.
ken#namenode:~$ docker start peaceful_babbage
peaceful_babbage
ken#namenode:~$ docker attach peaceful_babbage
root#1477050f192a:/#
root#1477050f192a:/# java -version
bash: java: command not found
root#1477050f192a:/# source /etc/profile
root#1477050f192a:/# echo $PATH
/usr/lib/jdk1.7.0_60/bin:/usr/lib/jdk1.7.0_60/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root#1477050f192a:/# java -version
java version "1.7.0_60"
Java™ SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot™ 64-Bit Server VM (build 24.60-b09, mixed mode)
root#1477050f192a:/#
root#1477050f192a:/# java
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
The default VM is server.
...
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
^C
At this moment, I can’t do anything with this container. can’t kill the Java process either. Who can help me with this?
You can simply stop the container from the host :
docker stop peaceful_babbage
Im trying to set up weblogic in my machine.
I downloaded from http://www.oracle.com/technetwork/middleware/ias/downloads/wls-main-097127.html.
My PATH looks like this, C:\Program Files\Java\jdk1.5.0_22\bin;
Java - version in cmd prompt gives this,
C:\setups>java -version
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)
Now, when i execute the weblogic jar file using the command as specified in the oracle documentation, C:\setups>java -d64 -jar wls1035_generic.jar , I get the below error.
Unrecognized option: -d64
Could not create the Java virtual machine.
How should i get rid and execute the jar file to install weblogic? pls help.
I was having this issue. It happened because I had a 32bit JDK and not the 64bit JDK that was required by the weblogic install package
To check what version you have, you type the following in your terminal
java -d64 -version
If you get an error then that is your issue, proceed as below:
You can find the 64bit jdk at: Oracle
I think to avoid conflicts you might want to delete your current JDK