"Client" Java Virtual Machine with jsvc [duplicate] - java

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"!

Related

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

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!

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!

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/

Which JRE am I using?

There are two varieties of JRE available. Java VM: IBM vs. Sun.
Is there a way to know which JRE I am using through JavaScript or some Java issued command.
The following command will tell you a lot of information about your java version, including the vendor:
java -XshowSettings:properties -version
It works on Windows, Mac, and Linux.
System.out.println(System.getProperty("java.vendor"));
System.out.println(System.getProperty("java.vendor.url"));
System.out.println(System.getProperty("java.version"));
Sun Microsystems Inc.
http://java.sun.com/
1.6.0_11
http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html
Open up your:
command prompt if you're using Windows
terminal if you're using mac or Linux
Type in:
java -version // This will check your JRE version
javac -version // This will check your Java compiler version if you installed the JDK
Grab a cup of coffee and you're done! You don't need to add the .exe to the java -version if everything is installed correctly.
In Linux:
java -version
In Windows:
java.exe -version
If you need more info about the JVM you can call the executable with the parameter -XshowSettings:properties. It will show a lot of System Properties. These properties can also be accessed by means of the static method System.getProperty(String) in a Java class. As example this is an excerpt of some of the properties that can be obtained:
$ java -XshowSettings:properties -version
[...]
java.specification.version = 1.7
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.7.0_95
[...]
So if you need to access any of these properties from Java code you can use:
System.getProperty("java.specification.version");
System.getProperty("java.vendor");
System.getProperty("java.vendor.url");
System.getProperty("java.version");
Take into account that sometimes the vendor is not exposed as clear as Oracle or IBM. For example,
$ java version
"1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04) Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
HotSpot is what Oracle calls their implementation of the JVM. Check this list if the vendor does not seem to be shown with -version.
The Java system property System.getProperty(...) to consult is "java.runtime.name". This will distinguish between "OpenJDK Runtime Environment" and "Java(TM) SE Runtime Environment". They both have the same vendor - "Oracle Corporation".
This property is also included in the output for java -version.
Open a command prompt:
Version: java -version
Location: where java (in Windows)
which java (in Unix, Linux, and Mac)
To set Java home in Windows:
Right click on My computer → Properties → Advanced system settings → Environment Variable → System Variable → New.
Give the name as JAVA_HOME and the value as (e.g.) c:\programfiles\jdk
Select Path and click Edit, and keep it in the beginning as:
%JAVA_HOME%\bin;...remaining settings goes here
Git Bash + Windows 10 + Software that came bundled with its own JRE copy:
Do a "Git Bash Here" in the jre/bin folder of the software you installed.
Then use "./java.exe -version" instead of "java -version" to get the
information on the software's copy rather than the copy referenced by your PATH environment variable.
Get the version of the software installation: ./java.exe -version
JMIM#DESKTOP-JUDCNDL MINGW64 /c/DEV/PROG/EYE_DB/INST/jre/bin
$ ./java.exe -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Get the version in your PATH variable: java -version
JMIM#DESKTOP-JUDCNDL MINGW64 /c/DEV/PROG/EYE_DB/INST/jre/bin
$ java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
As for addressing the original question and getting vendor information:
./java.exe -XshowSettings:properties -version ## Software's copy
java -XshowSettings:properties -version ## Copy in PATH
I had a problem where my Java applications quit work with no discernible evidence that I could find. It turned out my system started using the 64-bit version rather than the 32-bit version was needed (Windows Server 2012). In Windows, the command:
Javaw -version
just brought me back to the command prompt without any information. It wasn't until I tried
Javaw -Version 2>x.txt
type x.txt
that it gave me what was being executed was the 64-bit version. It boiled down to my PATH environment variable finding the 64-bit version first.
As you are expecting it to know using the Javascript, I believe you want to know the JRE versioned being used in your browser. Hence you can include Java version tester applet which can exactly tell you the version of the current browser.
import java.applet.*;
import java.awt.*;
public class JavaVersionDisplayApplet extends Applet
{
private Label m_labVersionVendor;
public JavaVersionDisplayApplet() // Constructor
{
Color colFrameBackground = Color.pink;
this.setBackground(colFrameBackground);
m_labVersionVendor = new Label (" Java Version: " +
System.getProperty("java.version") +
" from "+System.getProperty("java.vendor"));
this.add(m_labVersionVendor);
}
}
To check actually runned Java version you can use java.lang.Runtime API available since Java 10.
Runtime.Version version = Runtime.version();
int javaVersion = version.feature();
// returns 17 for Java 17

Categories