简体   繁体   English

Anypoint Studio Maven在错误的java目录中查找tools.jar

[英]Anypoint Studio Maven looking in wrong java directory for tools.jar

I installed the latest version of Anypoint Studio (based on Eclipse) and created a new maven enabled project. 我安装了最新版本的Anypoint Studio(基于Eclipse)并创建了一个新的启用maven的项目。 I got the following error as maven tried to resolve all of it's dependencies: 当Maven尝试解决所有依赖项时,出现以下错误:

[ERROR] Unresolveable build extension: Plugin org.mule.tools.maven:mule-app-maven-plugin:1.1 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.5.0 at specified path C:\Program Files\Java\jre1.8.0_65/../lib/tools.jar -> [Help 2]

I have JDK 1.8 installed on the system, and have my PATH and JAVA_HOME environmental variables set. 我在系统上安装了JDK 1.8,并设置了我的PATH和JAVA_HOME环境变量。

Why is it looking in the incorrect location for the library? 为什么在错误的库位置查找?

It turned out that by default Anypoint Studio was pointing to the JRE rather than the JDK. 事实证明,默认情况下,Anypoint Studio指向的是JRE,而不是JDK。 This lead to it not being able to locate tools.jar . 这导致它无法找到tools.jar

First thing I did was I added the JDK by searching for it in the Java directory. 我做的第一件事是通过在Java目录中搜索JDK来添加它。 Open Window -> Preferences -> Java -> Installed JREs, Click search, then navigate to your JDK. 打开窗口->首选项-> Java->已安装的JRE,单击搜索,然后导航到您的JDK。 Once the JDK is added to the list, select it as the default run-time: 将JDK添加到列表后,将其选择为默认运行时:

Go to your project properties -> Java Build PAth -> Libraries. 转到项目属性-> Java Build PAth->库。 Remove the current JRE system library and click Add Library, search for your JDK under the list of installed JDKs. 删除当前的JRE系统库,然后单击“添加库”,在已安装的JDK列表下搜索您的JDK。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM