[java] Missing artifact com.sun:tools:jar

As other posters have stated the issue here has to do with the JRE that eclipse is using not being able to find the tools jar. I solved the issue by going in a bit of a different direction than what was stated above, and it was because of the way that my projects and environment.

Eclipse 4.5 requires at least Java 7 for runtime, so I've got my system setup to use a Java 8 JRE located at C:\java\jre1.8.0_45.

Next, I'm using a POM file that assumes that I'm running with a Java 6 JDK.

  <profiles>
    <profile>
      <id>default-profile</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <file>
          <exists>${java.home}/../lib/tools.jar</exists>
        </file>
      </activation>
      <properties>
        <toolsjar>${java.home}/../lib/tools.jar</toolsjar>
      </properties>
    </profile>
    <profile>
      <id>osx_profile</id>
      <activation>
        <activeByDefault>false</activeByDefault>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
      </properties>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.6.0</version>
      <scope>system</scope>
      <systemPath>${toolsjar}</systemPath>
    </dependency>
  </dependencies>

I'm not allowed to change the POM file, so I had to do some jiggery pokery. I copied the tools.jar from my Java 6 JDK, created the directory C:\java\lib and pasted it there. I then restarted eclipse and cleaned my project. And VOILA errors are gone.

It's not an elegant solution, and I would think that the proper solution would be to change the way the POM is setup, but as I was not able to, this works.

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to maven

Maven dependencies are failing with a 501 error Why am I getting Unknown error in line 1 of pom.xml? Why am I getting "Received fatal alert: protocol_version" or "peer not authenticated" from Maven Central? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Unable to compile simple Java 10 / Java 11 project with Maven ERROR Source option 1.5 is no longer supported. Use 1.6 or later 'react-scripts' is not recognized as an internal or external command How to create a Java / Maven project that works in Visual Studio Code? "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository Java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException

Examples related to playn

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test Missing artifact com.sun:tools:jar