- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用集成有 Maven 插件的 Eclipse Juno。
我已经在我的系统上安装了 JDK 1.6。
我的环境变量是
JAVA_HOME - F:\Program Files\Java\jdk1.6.0_37
MAVEN_HOME - F:\apache-maven-3.0.4
classpath - ;.;%JAVA_HOME%\lib\tools.jar;
Path - C:\Program Files\AMD APP\bin\x86;C:\Program Files\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Windows Live\Shared;C:\Program Files\QuickTime\QTSystem\;.;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;
我的 JDK 和 JRE 运行顺利。
命令行检查:
在我的 Eclipse 中,我正在构建一个新的 Maven Web 项目,它应该给我一个 war 文件。
我的 pom.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.achutha.labs</groupId>
<artifactId>01JsfExample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>01JsfExample</name>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
<build>
<finalName>JavaServerFaces</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
如果我执行maven clean,那么它就成功了。但是当我安装 maven 时,它出现了一些 jdk 问题。
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building 01JsfExample 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ 01JsfExample ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.1:compile (default-compile) @ 01JsfExample ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to F:\Workspace\01JsfExample\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
F:\Program Files\Java\jre6\..\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.
[INFO] 1error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.554s
[INFO] Finished at: Mon Dec 10 06:54:01 IST 2012
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project 01JsfExample: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] F:\Program Files\Java\jre6\..\lib\tools.jar
[ERROR] Please ensure you are using JDK 1.4 or above and
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
[ERROR] In most cases you can change the location of your Java
[ERROR] installation by setting the JAVA_HOME environment variable.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
我在 eclipse 上的其他 java 程序编译并运行良好。除了 Maven 项目。由于上述原因,构建失败,因此未生成 war 文件。
如何解决这个问题?
最佳答案
您是否在 Eclipse 中运行 Maven 目标?如果是这样,则 Eclipse 似乎正在尝试访问 JRE 而不是 JDK:F:\Program Files\Java\jre6\..\lib\tools.jar
虽然 JAVA_HOME
似乎在 Windows 级别设置正确,但在 Eclipse 中您可能使用 JRE 而不是 JDK 运行应用程序。在 Eclipse 中,查看已安装的 JRE 列表(窗口 -> 首选项 -> Java -> 安装的 JRE)。如果您没有 JDK,请在选择 JRE 后单击“编辑”,然后在该对话框中输入 JDK 的位置。
关于maven - JDK和Maven冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13793978/
我对第一个问题的直觉是肯定的。对于第二个问题,我在工作中确实看到,有人使用 JDK8 和 ANT,然后将用 JDK6 编写的旧包编译到 1.6。我真的很困惑。 最佳答案 一般来说,java 向后兼容所
据我所知,在windows中使用JDK有两种方式: 下载JDK安装文件并安装。 下载 JDK 二进制文件。 它们有什么区别? 最佳答案 优点:简单易行,突然间一切正常。 缺点:现在一切都使用新版本 -
我正在安装 HANA Studio,并且已下载 JDK 1.8 和 JDK 1.7。我将 JDK 1.8 用于 Eclipse 和我正在处理的其他一些事情,但是当我尝试通过 SAP HANA 生命周期
JDK 7 的哪些特性(不包括 invokedynamic,因为它不被 java 使用)导致新的类文件版本与 JDK 6 不兼容。似乎所有特性都可以通过编译器生成胶水代码来实现。例如 switch 语
在redhat机器上安装cloudera的库来创建cloudera集群是否必须使用Oracle JDK而不是Open JDK? 最佳答案 在撰写本文时,只有 Oracle JDK 版本经过认证可与 C
下面的语句在 Java 7 中有效吗? Timestamp.valueOf("0000-00-00 00:00:00.000000"); 因为使用 JDK 1.6 构建上述代码效果很好,但在使用 JD
更新 在整个评论中,结果证明我采用的基准测试方法是不正确的,因此结果具有误导性。纠正我的方法后(如已接受的答案),结果正如人们所期望的 - JDK 13 的性能与 JDK 11 一样好。有关更多详细信
我们很快就会从 jdk14 迁移到 jdk16。我们的是桌面应用程序。我需要采取什么措施来确保它在客户端机器上正常工作?现在他们中的一些人使用 JRE4 和一些 JRE6.Server-Solaris
我在/usr/lib/jvm 中有 jdk1.7.0 目录以及其他 open-jdk 版本。我希望我的 Ubuntu 12.04 将此 jdk(jdk1.7.0) 视为其主要 jdk,即我不想使用 o
我认为这可能与 Why does a generic cast of a List to List succeed on Sun JDK 6 but fail to compile on Oracle
代码使用 JDK 8 (1.8.0_212) 编译良好,但使用 JDK 11 (11.0.3) Oracle jdk 和 open jdk (aws corretto) 编译失败 尝试使用 javac
是否可以在 cygwin 上安装任何版本的 Sun JDK 或 Open JDK。 我寻找此选项的原因是:有许多工具(例如 jStack、jMap)在 JDK 的 unix 版本中可用,但在 wind
请确认以上说法? 当他们提到 JDK 时,我需要知道他们指的是什么。 最佳答案 Java Development Kit 是我们通常指的一组创建 Java 应用程序的工具,包括 Java Compil
使用 java -version 给我这个。 java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
这个问题在这里已经有了答案: JAVA_HOME should point to a JDK not a JRE (25 个答案) 关闭 4 年前。 您好,感谢您提供的任何帮助。 我刚刚升级到 Ub
没错,自阿里、腾讯之后,华为也终于开源了自家的 JDK——毕昇 JDK! 免费!免费!免费!!! Oracle 要慌了? 毕昇 JDK 毕昇 JDK 是华为内部 OpenJDK 定制版 Hu
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭去年。 Improve this quest
将 Arquillian 添加到 Maven 构建时,我在 Eclipse 中遇到上述异常: Missing artifact sun.jdk:jconsole:jar:jdk
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 5 年前。 Improve this ques
我正在尝试创建一个 pom,它将: 使用 maven-toolchains-plugin 中的正确 JDK基于 java.version 属性。 根据 maven-toolchains-plugin
我是一名优秀的程序员,十分优秀!