Missing com.sun:tools:jar:1.4.2
Error message: Missing:
----------
1) com.sun:tools:jar:1.4.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) HRTrainingModel:HRTrainingModel:jar:1.0-SNAPSHOT
2) commons-attributes:commons-attributes-compiler:jar:2.1
3) com.sun:tools:jar:1.4.2
----------
1 required artifact is missing.
for artifact:
HRTrainingModel:HRTrainingModel:jar:1.0-SNAPSHOT
from the specified remote repositories:
Eclipse (http://repo1.maven.org/eclipse/),
Maven2 (http://repo2.maven.org/maven2/),
central (http://repo1.maven.org/maven2),
JBOSS (http://repository.jboss.org/maven2/),
Ibiblio (http://www.ibiblio.org/maven/mule/dependencies/maven2/)
Group-Id: HRTrainingModel
Artifact-Id: HRTrainingModel
Version: 1.0-SNAPSHOT
From file: C:\WorkspaceMyEclipse\HRTrainingPersistence\pom.xml
Solution: You can use command line to resolve this but here how I did it.
1. Right click on the project to import the jar file manually because, I could not find the tools.jar file from any publicly available repositories. I have set up the JAVA_HOME = C:\Program Files\Java\jdk1.6.0_10
Step 2. Setup Artifact form as follows.
Once you click okay, the Maven repository should looks like as follows.

3. Now, the last step. Open up the pom.xml file add the dependency.
<dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.4.2</version> </dependency>
Under Maven Dependencies, you should able to find tools.jar.

Similar issue:
FAILED for project:
HRTrainingModel:HRTrainingModel:jar:1.0-SNAPSHOT
Reason:
Unable to locate the Javac Compiler in:
C:\Program Files\MyEclipse 6.6\jre\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
Caution: You must have both the Maven JDK and the default Java JDK set to the same version.
See Jason Lee’s two comments under Comments tab below.
7 Comments »
Leave a Reply
-
Archives
- January 2011 (3)
- September 2010 (1)
- August 2010 (1)
- May 2010 (1)
- April 2010 (1)
- November 2009 (1)
- July 2009 (1)
- June 2009 (5)
- May 2009 (2)
- April 2009 (4)
- March 2009 (2)
- January 2009 (3)
-
Categories
-
RSS
Entries RSS
Comments RSS


Hwy, Hobi. Instead of importing tools.jar into your Maven repo, you should probably do this:
default-tools.jar
java.vendor
Sun Microsystems Inc.
com.sun
tools
1.4.2
system
${java.home}/../lib/tools.jar
Taken from: http://maven.apache.org/general.html#tools-jar-dependency
Let me try that again. hehe
<profiles>
<profile>
<id>default-tools.jar</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.4.2</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
I’ve tried:
default-tools.jar
java.vendor
Sun Microsystems Inc.
com.sun
tools
1.4.2
system
${java.home}/../lib/tools.jar
but not working. It says:
[INFO] Scanning for projects…
[INFO] ————————————————————————
[INFO] Building
[INFO]
[INFO] Id: com.eon:mslms:war:0.0.1-SNAPSHOT
[INFO] task-segment: [deploy]
[INFO] ————————————————————————
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[WARNING] While downloading poi:poi:2.5.1-final-20040804
This artifact has been relocated to poi:poi:2.5.1-final-20040804.
[ERROR]
Transitive dependency resolution for scope: compile has failed for your project.
Error message: Missing:
———-
1) com.sun:tools:jar:1.4.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.4.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.eon:mslms:war:0.0.1-SNAPSHOT
2) com.sun:tools:jar:1.4.2
———-
1 required artifact is missing.
for artifact:
com.eon:mslms:war:0.0.1-SNAPSHOT
from the specified remote repositories:
com.springsource.repository.bundles.release (http://repository.springsource.com/maven/bundles/release),
central (http://repo1.maven.org/maven2),
com.springsource.repository.bundles.external (http://repository.springsource.com/maven/bundles/external)
Group-Id: com.eon
Artifact-Id: mslms
Version: 0.0.1-SNAPSHOT
From file: D:\Workspaces\MyEclipse 7.1\health\pom.xml
[INFO] ————————————————————————
[INFO] For more information, run with the -e flag
[INFO] ————————————————————————
[INFO] BUILD FAILED
[INFO] ————————————————————————
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue May 26 01:31:11 ULAST 2009
[INFO] Final Memory: 3M/15M
[INFO] ————————————————————————
RIGHT cLICK ON pROJECT -> PROPRTIES -> jAVA BUILD PATH -> SELECT jre sYSTEM PATH -> edit -> SELECT WORKSPACE DEFAULT jre ( POINT IT TO JDK > 1.4 )
[...] Missing com.sun:tools:jar:1.4.2 March 2009 4 comments 4 [...]
Pingback by 2010 in blog review « Hobione's Weblog | January 7, 2011 |
Set your eclipse to run with a JDK instead of JRE.
In Windows, modify eclipse.ini, adding:
-vm
C:/java/jdk1.6.0_25/bin/javaw.exe
http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F#Find_the_JVM
This can also happen when your JRE path cotain spaces for example C:/Program Files/java/jdk1.6.0_25/bin/javaw.exe – java dont like spaces. Change the path (reinstall) to C:/java/jdk1.6.0_25/bin/javaw.exe and set the same in Properties>Java>JRE and eclipse.ini setup file.