How to run a java program upon compilation of class

150 Views Asked by At

I have a java jar I want to invoke when a class is compiled using the Eclipse IDE :

java -jar myjar.jar args1 args2

Is there a java lib I can use for this or perhaps use a Scala macro ?

1

There are 1 best solutions below

1
On

you can right click your project select properties / builders / new. this will add an external program to be run. after project compilation. (it will only be once per compile, not once per compilation unit, which is what i think you are referring to). however its easy enough to keep track of that by your external program, and run something for every updated compilation unit (or newly generated class file)