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?

4
  • 1
    What do you mean synced? Are you sure that posting here is proper? Maybe you should post this question to stack overflow.
    – jason
    Mar 22, 2014 at 20:58
  • Your question is not clear please clarify it. Java code compiled on Windows will run on any version of Windows with that same version of Java installed. Update your question and be specific in what you want.
    – Ramhound
    Mar 22, 2014 at 21:55
  • 2
    It's not clear what you mean about hot-swapping, but you can't run a Java program without compiling it first.
    – Wyzard
    Mar 22, 2014 at 22:02
  • Have it on a network share accessable by the two computers ?
    – exussum
    Mar 23, 2014 at 20:00

1 Answer 1

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?

Not the answer you're looking for? Browse other questions tagged or ask your own question.