Which version of Java supports the -command option? - java

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.

Related

unable to start jar file with metaspace parameter

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.....

How to use Javaw on windows JNI error has occurred Intellij IDEA to run GUI without console window

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.

java 7 command usage issue

I am getting:
java version "1.7.0_55" Java(TM) SE
Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
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
e.t.c
Can someone please tell me if you see some java options/arguments that don't belong in the java 7 command (options placed in new line for perspicuity):
"C:\Program Files\Java\jdk1.7.0_55\bin\java"
-server
-XX:+AggressiveOpts
-showversion
-XX:MaxPermSize=256m
-XX:+HeapDumpOnOutOfMemoryError
-Xmx512m
-Dcom.sun.jini.reggie.initialUnicastDiscoveryPort=4169
-Dcom.gs.deploy=C:\gigaspaces-xap-premium-9.7.1-ga-b10800/deploy
-DagentId=
-DgsaServiceID=
-DenableDynamicLocators=
-Xbootclasspath/p:"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\\lib\platform\xml\*"
-cp ;"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\";"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\\lib\platform\sigar\*;";"C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\\lib\platform\boot\gs-boot.jar";
-Dsun.rmi.dgc.client.gcInterval=36000000
-Dsun.rmi.dgc.server.gcInterval=36000000
-Djava.rmi.server.hostname=""SOMEONE-PC""
-Djava.rmi.server.RMIClassLoaderSpi=default
-Djava.rmi.server.logCalls=false
-Dcom.gs.jini_lus.locators=null
-Dcom.gs.jini_lus.groups=me
-Dcom.gs.logging.debug=false
-Djava.util.logging.config.file="C:\gigaspaces-xap-premium-9.7.1-ga-b10800\tools\groovy\bin\..\..\..\/config/gs_logging.properties"
com.gigaspaces.start.SystemBoot
com.gigaspaces.start.services=\"GSA\"
gsa.gsc 0 gsa.global.gsm 0 gsa.lus 1
It was some issue with this part in the path:
\tools\groovy\bin\..\..\..\
changing those arguments made it possible to run the command in java 7.
Cheers!

How I can play with EC2 API tools?

I'm getting the error to run the script "ec2-describe-regions"
$ec2-describe-regions
/usr/local/ec2/ec2-api-tools-1.6.14.1/bin/ec2-cmd: line 62: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java/bin/java: Not a directory
Before it, I did followings:
Open a terminal on my personal computer.
Install Java.
Create security credentials (an X.509 certificate and private key).
Set up a few environment variables.
Run my first command.
Here is the information I did:
$which java
/usr/bin/java
$echo $EC2_HOME
/usr/local/ec2/ec2-api-tools-1.6.14.1
$echo $JAVA_HOME
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
$java -version
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
Try the following:
mv /usr/bin/java /usr/bin/java.orig
ln -s /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java /usr/bin/java
You may have two or more java instances on your server. Make sure you use the same java executable where your JAVA_HOME points to.
This command uses the old CLI tools, i'd recommend you use the new, unified and greatly improved CLI:
https://aws.amazon.com/cli/

JVM terminated. Exit code=8.. How can i resolve it in Ubuntu?

I get this error from eclipse(installed on Ubuntu 13.04):
JVM terminated. Exit code=8
/usr/bin/java
-Xms40m
-Xmx512m
-jar /home/davide/Scaricati/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
-os linux
-ws gtk
-arch x86
-showsplash /home/davide/Scaricati/eclipse//plugins/org.eclipse.platform_4.2.2.v201302041200/splash.bmp
-launcher /home/davide/Scaricati/eclipse/eclipse
-name Eclipse
--launcher.library /home/davide/Scaricati/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20120913-144807/eclipse_1502.so
-startup /home/davide/Scaricati/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.overrideVmargs
-exitdata 730004
-vm /usr/bin/java
-vmargs
-Xms40m
-Xmx512m
-jar /home/davide/Scaricati/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
How can i resolve it? .
It is probably because you are using incompatible JVMs. You probably
ran an update the settings were changed in the background. This is
what worked for me:
1) Run: sudo update-alternatives --config java
2) Choose a different JVM
www.anintegratedworld.com/ubuntu-eclipse-jvm-terminated-exit-code8/
It should need java files/resources to install
Type
1)java -version
if it shows not found...
then type
2)export PATH=/home/Desktop/jdk1.8.0_111/bin:$PATH
3)java -version
then it displays (java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Server VM (build 25.111-b14, mixed mode))
4)now try installing by typing ./eclipse after going to the path

Categories