com.sun.tools.javac.Main is not on the classpath.
I'm not sure this is the right solution but I found a workaround from this answer:
Using javah maven-antrun-plugin with jdk 1.7, classes.jar became tools.jar
I also utilized this answer: JDK tools.jar as maven dependency
I ended up adding a specific dependency for Windows in the pom which added the tools.jar
specifically to the classpath:
<profiles>
<profile>
<id>windows</id>
<activation>
<activeByDefault>false</activeByDefault>
<os>
<family>windows</family>
</os>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
This adds a dependency only if the OS family is windows
. The system-path ../
is necessary in the path because ${java.home}
ends up as $JAVA_HOME/jre
for some reason. The version
didn't seem to matter since 1.7 and 1.6 seemed to work.
Hope this helps other folks.