问题
I have been working on a Java project from my local machine using Eclipse. I am trying to run this on a remote machine. The remote machine is a cluster running on Linux. Right now I have mounted the remote drive and edit the remote file copy through Eclipse. However, I was looking something more robust. Is there any way to do this seamlessly through Eclipse, i.e. each time I run the project, it runs on the remote machine?
回答1:
- Set your project output folder to the remote folder you mounted (under Project Properties->Java Build Path).
- Then execute external tool: ssh user@rometesite -c "java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n Main"
- Launch in eclipse a Remote Java Application (port 4000)
see http://www.ibm.com/developerworks/opensource/library/os-eclipse-javadebug/index.html for more detailed information about remote debug.
回答2:
Target management/Remote System Explorer provides plugins to keep a remote directory in sync with your project. See http://www.eclipse.org/tm/
To run your program remotely, you would probably have to set up an External Tool launch config (from the Run>External Tools menu) and use a program like ssh to launch your java app remotely on the linux cluster.
回答3:
Here is a great tutorial to do it : http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fdebug%2Fref-execution_environments.htm and this one is usefull too : http://java.dzone.com/articles/how-debug-remote-java-applicat
回答4:
This sounds like a great situation for a continuous integration solution. Have you considered setting up CruiseControl? I realize that might seem like overkill if you're just a single developer working on something. And if you don't want to move a JAR file over to the remote machine you probably won't be up for this either.
But continuous integration is worth the trouble once it's set up. Beyond the automated deployment (which is what you're asking for here) you'll get a debug/test environment that everyone in your group can use. Plus it forces you to solve the packaging/deployment problems up front which, while not fun, gets you one big step closer towards a truly iterative development process.
来源:https://stackoverflow.com/questions/5734309/run-eclipse-project-on-a-remote-machine