Search code examples
javaeclipse

How to start multiple instances of the same Java project in Eclipse?


I'm developing nodes which should simulate UDP communication in between themselves. It should be possible that these nodes are started on different computers, so i'm interested in how could i test this the easiest on my computer. So what i need specifically need is how to start the same project in Eclipse multiple times, possibly with different command line arguments.


Solution

  • The command line arguments are stored in Eclipse in a Run Configuration (menu: Run > Run Configurations..., or Run > Debug Configurations...).

    Just create two of them, reference the same main class, and specify different command line arguments, e.g. to specify different ports, then Run/Debug both of them.

    No need for two Eclipse instances. You can easily have many running programs, even for the same Run Configuration, assuming they don't conflict on some shared resource like a port.

    The Console view will keep the output from each running program separate. Use the Display Selected Console toolbar pull-down in the upper right of the Console view to switch between them.