How to let the HotSpot VM be in debug mode? - java

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

Related

DCEVM java patch is not working

I am trying to replace standard JVM of jdk1.8.0_112 with Dynamic Code Evolution VM using
DCEVM-light-8u112-installer.jar
but when i checked jvm version after patching with command
c:>java -version
it is still showing same Server VM as below
1 java version "1.8.0_112"
2 Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
3 Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
at line number 3, i am expecting type of Server VM as
Dynamic Code Evolution 64-Bit Server VM (build 25.71-b01-dcevmlight-10, mixed mode)
please guide me on this
The light version of the DCEVM project provides a single jvm.dll file that is a replacement for the default jvm.dll file included with Oracle/OpenJDK JDKs. The light version does not overwrite the file included with the JDK/JRE installation but rather installs the DCEVM JVM as an alternate implementation. Therefore, java -version will continue to show the default Java version details.
If DCEVM was installed successfully, java -version -XXaltjvm=dcevm will show the DCEVM version details, as expected.
java -version will return the DCEVM JVM version details if the full version of DCEVM is installed. Currently the DCEVM project provides full binaries only for Java 7. However, there is very little functional difference between the light and full versions so there is no real need to install the full version.

RHEL Java taking too long to start

I have installed RHEL 6.5 and am facing a performance issue with java.
# time java -version
java version "1.6.0_34"
OpenJDK Runtime Environment (IcedTea6 1.13.6) (rhel-1.13.6.1.el6_6-x86_64)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)
real 0m45.243s
user 0m0.149s
sys 0m0.086s
Try to install version java version "1.8.0_31" and see if the numbers does improve.
rpm -ivh jdk-8u31-linux-x64.rpm
Also check the configuration page from RHEL. https://access.redhat.com/documentation/en-US/JBoss_Communications_Platform/5.0/html/Platform_Installation_Guide/chap-Installing_and_Configuring_Java.html
I found out that it was McAfee's nails process which was slowing down not only java but many other system processes. Stopping resolved the issue.

javadoc doesn't found in my linux machine

I'm running on ubuntu 12.04 and when I put in the terminal java -version I got this message:
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
but despite that, if I put in the terminal javadoc I receive a message as it isn't installed in my machine.
The Java Runtime Environment (JRE) doesn't include javadoc. It includes only the things required to run Java programs, not to develop them.
You need the JDK (Java Development Kit) which includes developer tools like javadoc, in addition to everything found in the JRE.
See the Ubuntu Java documentation.

How do i know which default settings are enabled for Sun JVM?

i want to try CompressedOops on my JVM. No I wonder if it might be enabled by default. I run this jvm on debian/squeeze:
$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)
Some people say it is enabled by default, some say it is not:
from: http://forums.yourkit.com/viewtopic.php?f=3&t=3185
Yes, you are right, I also checked it
and Compressed Oops is not activated
by default in Java6u21 64-bit, I do
not understand why it said so in the
links I provided.
I tried to check it with jconsole/JMX but had no luck to find an attribute named CompressedOops or alike.
Does anybody know where i get a list of all jvm options for a specific build with their default values?
regards
Janning
You can run with -XX:+PrintFlagsFinal to print the values of all flags at startup of the JVM.
Alternatively, you can use the jinfo tool to check the value of a flag in a running JVM:
> jinfo -flag UseCompressedOops 7364
-XX:+UseCompressedOops
Use jps to find the pid of the process.

Setting HotSpot(TM) Server VM in Java 1.6 environment

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 !

Categories