Can VisualVM monitoring apps running on JRE - java

as the headline mentioned: is it possible to connect VisualVM to an remote application running on JRE instead of JDK ?
And yes, the VisualVM itself runs on JDK !
Kind regards
Dominik

VisualVM connects to a running Java Virtual Machine (JVM).
And this JVM is contained both in the JDK and the JRE.
In fact, the JDK is a JRE with additional tools and items to allow creating Java programs. If you only want to run them, you only need a JDK.
So yes, you can connect to a JRE-only install.

Related

How to monitor JVM with JRE only

I have a Centos7 server and I want to monitor the JVM in order to identify performance issue but I have only JRE installed on the prod environment as follows:
Based on the research I saw there were some tool available such as Java Mission Control but it is only available with JDK but I have JRE installed. Any idea what open source tool I can use to monitor the jvm on centos with only JRE installed?
jattach gives you access to a few powerful tools, namely jcmd which you can then use to run various diagnostics commands against the java app.
Works with plain JRE - check https://github.com/apangin/jattach
See also https://docs.oracle.com/en/java/javase/17/docs/specs/man/jcmd.html

Is there any way to run a Windows-based Eclipse with a Linux-based Java SDK?

I want to test my code against the (beta) IBM Java SDK 8.0, which will be a part of IBM Java products in future and support Java SE 8. The beta version is available for download from here, but it's only available for Linux on x86 (/ x86_64), and not Windows. But my development environment is Windows. Of course, I could run the Java SDK through Cygwin or equivalent, so it's possible to execute the binaries, but is there any easy way to trigger them from an Eclipse instance running on Windows?
I don't think you can do this. I would be surprised if it worked under Cygwin too.
The usual strategy for this type of problem is to create a Linux VM and test using that. There are free VM solutions around such as VirtualBox.

Which JRE is required to run servlets..Server JRE or Client JRE?

I Am trying to run servlets so i want to know which one to download Client JRE or Server JRE as there are two JRE available on Oracle website? I have JDK 7 installed.
The main difference between the server and client VM is the different number of optimizations each one is doing (there are other differences ofcource). In other words you can run servlets with both VM but you will need a servlet container like tomcat or an application server. For development you will need a JDK which contains a JRE
Install the JDK from the Oracle's Website (http://www.oracle.com/technetwork/java/javase/downloads/index.html)

How can I use JVM Client Mode on x64 operating system?

I need to run the Oracle JVM in the "client mode". Is there any option to do this on an x64 operating system?
I installed Oracle 7 JDK per apt-get. It installed the Oracle JDK and JRE x64 edition. So i have only /usr/lib/jvm/java-7-oracle/jre/lib/amd64/server directory and no amd64/client directory.
On the Oracle website, you can download the JRE Linux x64 and x86 packages, precompiled. I download them both and looked into the folders.
x64 package contains only amd64/server directory.
x86 package contains i386/server AND i386/client directories.
So, what can I do to use the client mode? Have I install the x86 edition of java? I think I can do this only manually and not with apt-get because it recognize that I have a x64 operating system.
Thanks!
AFAIK the 64bit version of the Oracle JVM only supports the server mode at the moment (my guess is we'll never see a client version). This FAQ would see to support that. I don't think the Open JDK project has a 64bit client version either but it's been a while since I checked: this post confirms my suspicion. It seems the server VM is as good as or better than any dedicated client VM would be.

Jconsole cannot connect to java processes running as Windows 7 Services

We have a Java process which we run as a Windows service (using srvany). It runs with Java 1.6 (1.6.0.23 at the moment).
In the past (Windows XP), I could connect JConsole to the processes, on Windows 7 I cannot do this anymore.
If I run jconsole <pid> I get “Invalid process id:4488”. The services are running as SYSTEM user.
If I make the service run as my desktop user (using “Log On as This Account”) the services process ID appear in JConsole, but they are grayed out and I cannot connect.
Is it impossible to dynamically connect to Java processes when they are running as a Windows 7 service?
Perhaps it is a 64bit/32bit problem, I have several applications compiled with 32bit JDK, which could not be opened with JConsole from 64bit JDK on Windows 7 64bit, after I downloaded the 32bit JDK it worked.
Others have been able to run jstack on 2008r2 which may provide some insight on how to get jconsole to connect on Windows 7. As you noted in your comment, the permissions are important. If the service and jconsole can't access the temp directory to write to the appropriate hsperf subdirectory, it won't work. What is also important is the location of the temp directory, the user the service is running, and the user that is running jconsole.
Running SysInternals psexec -s -i <jdk_home>\bin\jconsole <PID> can be used to run jconsole as Local System, the same user that I believe you are using to run your service.
My experience running jconsole from JDK 1.5 in Server 2008 as a system user was unsuccessful. With permissions that I thought should have been sufficient, I got a Could Not Open PerfMemory error. Java 1.6 may be a different story.
In light of all the challenges with running jconsole locally, you would probably have better luck setting it up to accept remote connections. You could set it up for local-only access with your firewall blocking that port from external access.
Add the following to JAVA_OPTION
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Then,
Use JConsole to connecet remote session:
localhost:8086
I am currently facing the same problem but on Windows 2003 R2 (SP2). There is on open bug in Oracle Bug database (bug id 6399729)
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6399729
Also there is a work-around posted towards the end. It talks about installing java in "install" mode :-), but didn't work for me on Windows 2003 though. But your mileage may vary!!
Change Environment Variable TEMP and Tmp to a different folder that you created.
Like c:\theTemp
It might be a problem with the folder %TMP%/hsperfdata_{USER_NAME}.
In my case, it worked after I :
close all applications running over the JVM
delete the folder %TMP%/hsperfdata_{USER_NAME} (exemple: C:/Temp/hsperfdata_MyUser)
reopen JConsole (it recreates the folder)
Hope it helps. You can also take a look at this thread in Oracle community.

Categories