I would like to debug my Java application usually locally, but sometimes on a remote server. I was thinking about rsyncing the class files and the jar dependencies to the remote server (perharps in an ant script) that is run occasionally, and then running the application remotely by ssh and using an ssh tunnel for connecting to the remote JVM.
This is easily achieved by running the rsync part as a Builder and the ssh tunnel as an external tool which is ran before debugging sessions. However, I would like to simply launch the remote debug configuration and have it up & running. Ideally, I would like to execute some code snippet before Eclipse tries to connect to the remote JVM, and possibly have its output appear in a Console view.
Is there any way of achieving this with some plugins (it is not supported out of the box)? I suppose I could write a quick hack as an Eclipse plugin, but I would prefer not to reinvent the wheel.
If installing CDT is an option, then you could use its launch groups for running your external tool together with the normal launch configuration:
Alternatively you may want to have a look at the EclipseRunner plugin. While it can organize launch configurations in groups, I'm not exactly sure if the groups can be launched as such.
Related
I have a machine that runs batch scripts over ssh on windows machine using open ssh and cygwin (copssh)
I'm looking to change this mechanism since this tool requires configuration where many mistakes can be made.
I will also need to collect the results of the script
Any ideas on how it can be done?
Thanks
You can use RMI and on the remote side just use Runtime.getRuntime().exec
I'm trying to figure out how to debug my jar that is running remotely. Here is my scenario:
My .jar will be running from a VPS. This jar basically runs a server
for a game, so it also connects to a mysql db. I start the server with 3 .bat files that looks something like this:
set CLASSPATH=.;dist\aries.jar;dist\mina-core.jar;dist\slf4j-api.jar;dist\slf4j-jdk14.jar;dist\mysql-connector-java-bin.jar
java -Xmx500m -Dwzpath=wz\ -Djavax.net.ssl.keyStore=filename.keystore -Djavax.net.ssl.keyStorePassword=passwd -Djavax.net.ssl.trustStore=filename.keystore -Djavax.net.ssl.trustStorePassword=passwd net.world.WorldServer
pause
What I want to do is start the server on the vps like normal, but debugging the server on my local machine via Netbeans IDE. I don't know if this is possible because people will be connecting to the server (although, I will be debugging a test server which will only have me online).
Note: I have done a lot of searching before coming here and a lot of what I found had to do with using xdebug & php which has doesn't have much to do with my situation (I don't think)
-Thanks
There's a NetBeans FAQ page about this.
In brief:
Add the remote debugging options to your Java command. For example:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8888,suspend=n
Then, use the attach debugger option in NetBeans and select your server and the port you used above (8888). It's pretty much that easy.
You may want to think about network and firewall considerations, as you may have noticed there are no passwords involved, so anyone who can connect to the port can debug your app. This could be a big security risk. Your VPS provider probably has some tools to help with setting up a secure, private connection.
How does DRMAA work? Can a local Java program using DRMAA start jobs on a remote cluster over SSH (so that nothing will need to be installed on the server-side)?
Background:
I'm developing a general (or as general as possible) HPC client in Java/Eclipse RCP, and
wanted to use DRMAA in order to support any resource manager as backend.
I have the SSH connection functionality through the Remote System Explorer (RSE) Eclipse plugin already.
Most of the DRMAA implementations use the native API calls (the same which are used inside the qsub/bsub/sbatch... commands). One can see DRMAA as the "ODBC for the batch systems".
Most of the DRMAA implementations require you to run it from submit host of your local cluster, there is no SSH inside. What you can try to do is to build a portable, DRMAA based "drmaa-run" command (example: http://apps.man.poznan.pl/trac/drmaa-misc/browser/drmaa_utils/trunk/drmaa_utils/drmaa_run.c) and run it via SSH.
I've got this new project at work. We are using Eclipse for the project. There are two run configurations, server and client. I have to launch the server and the client independently, and connect to the server using the client. Now, it so happens that this has to be done on both Windows and Linux. (four possible combinations: WS-LC, WC-LS, WS-WC, LS-LC, where W-windows, L-linux, C-client and S-server)
I have Linux on my machine (in which Eclipse is running) and run Windows on a VM. Is there a way I can make Eclipse launch the application in the VM?
I understand I have to build the application locally to a shared folder and send a launch command to windows (using openssh?, not sure). What are the best practices used in this scenario.
EDIT: I need to use this during development, to test my changes to the code. The same application provides both client & server. (yes, horrible, i know :X )
You can publish the server functions as JMX Beans using the MBean interface standard. Then use JMX Console to remotely connect to the server JVM and launch the application.
Eclipse has integration points for remote servers, look to "tomcat configuration" for an example of how it integrates with one remote server.
Whether your application can use an existing server integration solution or not depends heavily on details which aren't present. If you want to actually launch a stand-alone Java process from your remote machine, you generally need a program to capture the request and launch the process.
I've search around, read relevant questions on this site and others, but have failed to find a solution. It strikes me odd that one does not exist so let me detail my question here:
I use Junit4 + Eclipse regularly to test my code. In some cases, certain tests can take a lot of CPU and/or memory, rendering my workstation unusable for the duration of the test. This is a pain I'm trying to solve.
I'm looking to get the exact same behavior but through a remote server. I want:
To still be able to set breakpoints and debug my app.
To see how the tests progress using the Junit view in Eclipse.
Click on a button have the tests started (build process and copying of files is allowed, but only if efficient).
In my mind I envision something that rsyncs the files to the remote server, starts the java process there with the exact same arguments as it would on my local machine, makes the debug port available (not just localhost) and has eclipse hook up to it to have both debug and junit view working.
How can I get this done?
Several leading questions that may help us find a solution:
How does Eclipse communicate with the java process when run locally (for both debug purposes AND the Junit view)?
How can I involve myself in the process of spawning the java process for the JUnit testing so I can copy the required files over to a remote server?
How can I make the process spawn remotely instead of locally?
How can I have Eclipse hook up to the remote host instead of the localhost?
The easiest would be to invoke command line JUnit runner on remote mashine using the following command:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8998,server=y,suspend=y -cp ... org.junit.runner.JUnitCore <test class name>
So, it will wait til you attach remote debugger from Eclipse at port 8998.
You can also use Eclipse's Target Management tools to transfer files to remote system and launch remote commands. There is several tutorials on the project page.
You could set up a jenkins CI server, sync your code via git (or just copy using ftp or something), execute the test in a jenkins job triggered by a git-hook or through some script. Then remote debug into the running test process like Eugene Kuleshov suggested. This process could be automated by an ant-script which you invoke from eclipse. There should be a mylin connector (for example) through which you can monitor the running tests. I don't know if it is possible using the standard JUnit view of eclipse to see the running tests without using some custom plugins (if any exist).
Try vs code remote ssh extension for this.