Setting HotSpot(TM) Server VM in Java 1.6 environment - java

I have a question related to setting Java hotspot server VM in java 1.6
is there any way to set Java HotSpot Server VM in java 1.6 environment? When i run following command
java -version
it's showing as below,
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)
I want this has to be displayed as below in third line.
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode, sharing)
Is there any command so that whenever we run java -version, it will always show Hotspot Server VM rather Client VM??
Thanks
Robert.

Add the -server flag:
java -version -server
outputs
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)

You should try 'java -server -version' instead. You will need to have the server hotspot compiler installed or use that on the JRE that comes bundled with the JDK (which comes with server hotstpot).

I seem to remember reading somewhere that the JVM will start in server mode automatically if the system meets certain specifications in terms of number of processes and amount of memory. Can't remember the details or find the info though.
Edit: Found some info here
http://download.oracle.com/javase/6/docs/technotes/guides/vm/server-class.html
Server class machine is > 2Gb RAM and > 2 processors.

Simply add the '-server' flag !

Related

Check the if version of JDK installed on macOS is the correct one

I have a macbook with latest HighSierra installed and from System Preferences / Java Panel. It says that i have got latest Java version installed: java 8 update 181.
From the "Java" tab of the aforementioned "Java settings" dialog i can see that the version 181 it is referring to is installed in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
If i try to execute that binary (i.e. java -version) i actually get:
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build
1.8.0_181-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
however when i try to launch "java" from a generic prompt or if i try to execute javac i get a different result:
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
this latter java is installed in /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/
So it seems to me that i have got a jre (181) and a jdk (40) is this correct?
if so, is this the correct setup on mac? i started to wonder when forticlient analyzer showed up a bunch of CVE security issues related to JDK that are fixed in update 181.

topcoder java client blocked by java security

I'm using javaws ContestAppletProd.jnlp to run the latest topcoder client on ubuntu 16.04.
java version is
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).
I've added http://www.topcoder.com to the exception site list in java security control panel, but it doesn't work.
This is the trace log file.

different java version between java_home and popen

In python IDE, i run these two code snippets and get different output for the java version:
stdout,stderr = Popen(['java','-version'], shell=False, stderr=PIPE).communicate()
print(stderr)
java version "1.7.0"
Java(TM) SE Runtime Environment (build pwi3270sr8fp10-20141219_01(SR8 FP10))
IBM J9 VM (build 2.6, JRE 1.7.0 Windows 7 x86-32 20141216_227497 (JIT enabled, AOT enabled)
J9VM - R26_Java726_SR8_20141216_0955_B227497
JIT - r11.b07_20141003_74578.05
GC - R26_Java726_SR8_20141216_0955_B227497
J9CL - 20141216_227497)
JCL - 20141217_01 based on Oracle jdk7u75-b12
os.system("java -version")
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
Why do i get a different java version inside my python IDE (PyCharm)? How can i change it?
I think this is because os.system() uses the shell (so will pick up any changes in .bashrc / .profile etc... Are you setting a different Java location in your $PATH / $JAVA_HOME in any of those?
I believe Popen doesn't invoke a shell (unless you set shell=true).
Disclaimer: Not tested this.

-Xss1m not being used

I'm trying to user -Xss1m option but it didn't look like the option was being used.
I did the following steps:
Add a runtime parameter -Xss1m
Open my java applet
Dump system and deployment properties (press on "s" in java console)
Check the value of javaplugin.vm.options (contains only -Djnlp.packEnabled=true)
enviroment details:
java -d64 -version
Got the response of:
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_45-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Do you have any idea how to make it work?

How to let the HotSpot VM be in debug mode?

The reason that I need the HotSpot VM be in debug mode, is that I want some JVM options, like -XX:+PrintCFGFile, be supported.
My current JVM version is like
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (suse-3.1-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
Do I have to install some tool/patch to achieve that?
Thanks!
After searching a while, the problem looks more clear now.
The reason that I can't use the option -XX:PrintCFGToFile is because the JVM I used is the product version, not debug version.
I found such a website which provides the debug version of JVM. Below is the link:
http://download.java.net/jdk6/6u25/promoted/b03/index.html
I have tested the version jdk-6u25-ea-bin-b03-windows-i586-debug-27_feb_2011.jar It works well, the option I mentioned above can be used, and an output.cfg file would be produced after execution of a Java program.
After installation, there would be such a series of folders \jdk1.6.0_25\fastdebug>. And I get the following version info:
java version "1.6.0_25-ea-fastdebug"
Java(TM) SE Runtime Environment (build 1.6.0_25-ea-fastdebug-b03)
Java HotSpot(TM) Client VM (build 20.0-b10-fastdebug, mixed mode)
From the jdb manual:
"A VM that is to be debugged with jdb must be started with the following options: -agentlib:jdwp=transport=dt_shmem,server=y,suspend=n"
This loads in-process debugging libraries and specifies the kind of connection to be made."

Categories