0

The problem is pretty much the same as listed here: JDK tools.jar as maven dependency

But I have tried all of the solutions, none of them works for me. All of them says

ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.0.0.RC4:run (default-cli) on project gs-rest-service: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:1.0.0.RC4:run failed: Plugin org.springframework.boot:spring-boot-maven-plugin:1.0.0.RC4 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.6 at specified path /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../lib/tools.jar -> [Help 1]

Through my early googling, it seems in mac it is replaced by classes.jar. I tried to change java_home to "..../Contents/", error remains as ".../Contents/Home/../lib/tools.jar"

I am new to Maven and am following this tutorial to build a simple REST WS with Spring: http://spring.io/guides/gs/rest-service/

Community
  • 1
  • 1
  • On my machine the `tools.jar` is located `/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools.jar` which makes the file location in your question the problem. Where do you define the path to `tools.jar`? – Peter Svensson Mar 13 '14 at 10:41
  • In the spring example there is no reference to tools.jar given? Why do you need it? – khmarbaise Mar 13 '14 at 10:59
  • @Peter Liljenberg, I am using OSX, there's no tools.jar, instead it uses classes.jar, see here:https://developer.apple.com/library/mac/documentation/java/conceptual/java14development/02-javadevtools/javadevtools.html – user3414824 Mar 13 '14 at 11:07
  • @khmarbaise, spring-boot-maven-plugin uses tools.jar as its dependency – user3414824 Mar 13 '14 at 11:09
  • @user3414824 I'm using OsX as well and I have a tools.jar that why I'm asking. Guess youäre running Java6 or have just installed the JRE – Peter Svensson Mar 13 '14 at 11:35
  • @Peter Liljenberg, thanks, problem sovlved. jdk 1.7 actually works! I was using 1.6 – user3414824 Mar 14 '14 at 00:58

1 Answers1

1

You can add tools.jar as dependency in POM.xml , with "scope"= "system" and "systemPath" equals to "/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools.jar "

Hope this helps

Regards

Jyotsna

Jyotsna Saroha
  • 678
  • 6
  • 13