hawk hawk - 8 months ago 90
Java Question

Run Java program from Eclipse Builders

I want to run a Java program as a builder before the Java Builder kicks in. The Java class to be run is part of another project within the workspace.

I can add Program builder but I don't want to point explicitly to a Java VM as my teammates may have their Java installed in different location. Is there a way to achieve this without referring to a particular JVM executable?

EDIT: Added screenshot of Eclipse Builders to show which config I'm talking about. Screenshot of Eclipse Builders configuration


I can run the java program using a normal launcher (.launch file created using Run/Debug Configuration). I figured out a way to make that work as a Builder step.

Simply move the .launch to .externalToolBuilders and modify the .project file in a text editor to pick up that .launch file.


Eclipse being the good boy it is, doesn't complain about the presence of a org.eclipse.jdt.launching.localJavaApplication as a Builder step and everything works smoothly. In fact if you edit this newly added Builder step it even shows the correct Edit launch configuration dialog.