java 7 command usage issue - java

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!

Related

"Client" Java Virtual Machine with jsvc [duplicate]

This question already has answers here:
Real differences between "java -server" and "java -client"?
(11 answers)
Closed 3 months ago.
jsvc has a -client option but it isn't available on my system:
/usr/bin/jsvc -help ...
...
-jvm <JVM name>
use a specific Java Virtual Machine. Available JVMs:
'server'
-client
use a client Java Virtual Machine.
-server
use a server Java Virtual Machine.
...
This seem to boil down to having library files in directory lib/client under JAVA_HOME -- but all I have is lib/server.
This directory does not exist on Arch Linux ARM aarch64 or macOS. Is that some separate install, or is jsvc simply wrong about the existence of such a VM in that place?
This is a lab box I haven't updated for awhile ... but it looks like recent JREs only have the "server" option:
C:\> java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
c:\>java -help
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.
Also:
c:\Program Files\java\jdk-11.0.1>tree lib
Folder PATH listing for volume OS
Volume serial number is 00000051 4C32:5A1F
C:\PROGRAM FILES\JAVA\JDK-11.0.1\LIB
├───jfr
├───security
└───server
<= Look Ma! No "client"!

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.

Docker container didn't work after the <java> command

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

gigaspaces gs.bat unable to execute java command

I am trying to execute gigaspaces 9.7.1-ga-b10800 gs-agent.bat (that in turn calls gs.bat) with java 1.7.0_55-b13.
With echo-ing I traced the issue at the line
%COMMAND%
from gs.bat.
Am I missing something? Is there a place I can check if some versions of gigaspaces and java are compatible?
The java version 1.6 works fine with this version of gigaspaces.
I read this:
Please note that from version 8.0
onwards, GigaSpaces XAP will no longer
support the Java 1.5 SDK, and will
require the use of Java 1.6 SDK or
higher. For details about Java 1.4 &
1.5 SDK EOL, please refer to the following
page:http://java.sun.com/products/archive/eol.policy.html
But it doesn't say anything about java 7 and gigaspaces 9.7.1.
The exact command is ([SOME...] represent some other string):
"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=[SOME-PATH-TO-GS-HOME]/deploy -DagentId= -DgsaServiceID= -DenableDynamicLocators= -Xbootclasspath/p:"[SOME-PATH-TO-GS-HOME]\tools\groovy\bin\..\..\..\\lib\platform\xml\*" -cp ;"[SOME-PATH-TO-GS-HOME]\tools\groovy\bin\..\..\..\";"[SOME-PATH-TO-GS-HOME]\tools\groovy\bin\..\..\..\\lib\platform\sigar\*;";"[SOME-PATH-TO-GS-HOME]\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=""[SOMETHING]"" -Djava.rmi.server.RMIClassLoaderSpi=default -Djava.rmi.server.logCalls=false -Dcom.gs.jini_lus.locators=null -Dcom.gs.jini_lus.groups=[SOMETHING] -Dcom.gs.logging.debug=false -Djava.util.logging.config.file="[SOME-PATH-TO-GS-HOME]\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
The output renders the following:
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
etc.
Best regards,
despot
For some reason java 7 doesn't like this path:
\tools\groovy\bin\..\..\..\
when investigating further I found out that JSHOMEDIR is being set to
[SOME-PATH-TO-GS-HOME]\tools\groovy\bin\..\..\..\
so in setenv.bat, I placed a
set JSHOMEDIR=%~dp0\..
before the line:
if "%JSHOMEDIR%" == "" set JSHOMEDIR=%~dp0\..
For some reason setting an (system/user) environment variable didn't change the value of JSHOMEDIR (and yes, I restarted the cmd).
There is also the same duplicated post at ask.gigaspaces.org with perhaps some additional answers.
Cheers!

Categories