Remote Java Debugging with Eclipse's Remote System Explorer - java

Does anyone have experience debugging java code (code lives on remote Linux server) using Eclipse's Remote System Explorer? I'm able to explorer files and use the built in shell but I can't get it to stop on any breakpoints within the eclipse ide.

I'm taking a punt that your remote java server needs to be started using something like:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y suspend=y -jar stockTradingGUI.jar
Then you will be able to connect using the eclipse remote debugger
For a full run down see: http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html

Related

How to run Java file on Google Cloud VM?

I want to run a java file on a VM instance I've created in Google Cloud under Compute Engine. However, it's not clear how to do this. I pressed SSH and uploaded the java file but I dont know what to do after that. It doesn't allow me to start the VM. Please, does anyone know how to do this? Run a simple java file on Google Cloud's VM?
You can't SSH into a VM that hasn't been started so the fact that you can SSH into the VM implicitly means it has been started.
If the .java file is accessible to the VM and the relevant JDK has been installed on your VM, you can compile and then it run like you'd run any other Java program. You can use javac for the compilation and java to run the compiled .class file. You can take a look at this article for more info on how to do that.

eclipse - Java Remote debugging does not hit the breakpoint

I am using Jetty 8 and trying to connect from Eclipse(Remote Debugging). I am using Java 1.6. I have the latest code in eclipse. The port is not blocked in firewall.
Jetty is running on port 8080. I opened the debug port on 5999 using the below command
java -Xdebug -agentlib:jdwp=transport=dt_socket,address=5999,server=y,suspend=n -jar start.jar.
I opened the application in browser(https://[servername]:8080) and logged in to the application.
Later I connected in eclipse(Run-->Debug configurations and gave hostname and port(5999)), breakpoint is not hit when I browse through the application in browser. But I could able to see the Threads in the eclipse, only the code is not hit in eclipse

Connect remote hadoop server using eclipse

I am trying to run some map-reduce programs on a remote server of Hadoop 2.0.0, which is running on CentOS 6.4 using ssh.
I am using Eclipse LUNA on my windows 8 machine.
Is there a way to run the programs directly on my Eclipse without converting them to JAR files?
If hadoop is running on a linux machine, you can not connect directly from windows. The connection has to be SSH.
I hope you are looking for something like this:
https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.rse.doc.user%2Fgettingstarted%2Fgusing.html
The correct answer (similar) to this is here:
Work on a remote project with Eclipse via SSH

Debugging a Java Code running in Oracle JVM

I have a code which is running inside Oracle JVM. Is there any way to debug the java code which is running inside the oracle jvm??
Thanks in advance..
Debugging method would be different depending on how you are running the program.
1.If you are running the code from a Java IDE (e.g. Eclipse), you can add Oracle JVM as Runtime (Preferences > Java > Installed JRE) and then launch the Java program from the IDE in debug mode (Debug As > Java Application). This will allow the execution to be suspended at the marked breakpoints and you can browse the code in IDE in suspended mode.
2.If you are running the code in a container or in a standalone JVM (class with main() method), then you may have to enable remote debuging while launching the program. For enabling remote debugging in a container, refer to your container docs. If you are running a standalone program, then use below command for launching the program:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n NameOfYourMainClass
Once your application is launched with remote debugging enabled, you can use an IDE (e.g. Eclipse) to debug. Refer to this article for detailed steps:
http://java.dzone.com/articles/how-debug-remote-java-applicat
I hope, it helps!

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