Running and debugging Java applications on a remote or virtual machine

I know how to remotely debug a java application on a machine where it already exists, but does anyone know of a solution that can run from a local workspace (like eclipse), pass any code in the local path to a remote or virtual machine, run it there and connect the remote debugger, all in one step? I expect that some server will need to be run on a remote computer in order to accept class files and execute them.

I once did something similar with JUnit, transferring local test files to a remote machine via RMI and executing them there, transferring the results back to my eclipse. Since these test tests are JUnit tests, it was easy to integrate them with JUnit-launcher and -tools from eclipse, but to debug the whole application, I suspect this is a little more complicated.

I would like to ask if there are any solutions for this or someone has done this before and will point me in the right direction.

There is something similar for VMWARE workstation, but I'm developing on Mac and not available in Fusion.

+4
source share
3 answers

It is not indicated if you want to debug a test application or something else. I will assume that this is a regular java application. You could simply configure the SMB share or ftp server on the remote virtual machine, and then use the ant task to collect all your class files and copy them to the second virtual machine. Since you are using mac, you can connect to ssh and run a java application with debug flags. Then it will be a two-step process:

  • Ant script that
    • Packs all compiled code
    • Copy compiled code (FTP, SCP, SMB or something like that)
    • Connects to ssh and launches the application with debugging options. You can use this option to wait while the server waits for an incoming connection.

Then on Eclipse you will have a remote debugging configuration that will connect to the remote computer in the specified code.

To do this, in one step, you can write a small Eclipse plugin that extends Debug Launcher. You can extend Remote Debug Launch to execute this copy code.

+2
source

I think you can automate deployment tasks with ant tasks performed in Eclipse.

0
source

With eclipse remote control, you can run ant scripts and applications in eclipse from a remote host.

0
source

Source: https://habr.com/ru/post/1302853/


All Articles