0

I want to use two separate computers: one for programming an application and one for testing. Is it possible to run the java program in between the two computers without having to build every time i change the code, but instead hot-swap the code?

ioanD
  • 1,065

1 Answers1

1

Every time you change the code you must re-build the app. The tool-chains are smart enough to only partially re-build the app, as necessary, but that is not relevant - you must rebuild the app, and I think it makes more sense to do so on your programming machine, not your test machine.

Now you need to deploy it to the test machine. You haven't mentioned what IDE you are using, but Eclipse is probably the most common for Java, and it allows you to define custom steps of the build process. In other words, you could add a step to the end of the build process that copies the jar file to a network share associated with the test machine. Look at project properties --> Builders --> New. What exactly you add will depend on your OS, but should make use of shell commands and Eclipse variable, e.g. ${project_loc}. Most IDE's should have something similar.

Next you need to setup something on your testing machine that will run the app every time its JAR file changes. Here are some answers that describe how to that:
https://stackoverflow.com/questions/4060212/in-linux-how-do-i-run-a-shell-script-when-a-file-or-directory-changes
How to execute a command whenever a file changes?

Tom
  • 219