我正在尝试使用 Vertx 平台运行 Java 小程序,但出现以下错误,因为我不懂 Java。我很难理解如何修复这些问题,非常感谢您的帮助。
[root@ip-X mycompany]# vertx run Bidder.java
Failed in deploying verticle
java.lang.RuntimeException: Compilation failed
at org.vertx.java.platform.impl.java.CompilingClassLoader.<init>(CompilingClassLoader.java:108)
at org.vertx.java.platform.impl.java.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:51)
at org.vertx.java.platform.impl.DefaultPlatformManager$21.run(DefaultPlatformManager.java:1723)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: Unable to detect java compiler, make sure you're using a JDK not a JRE!
at org.vertx.java.platform.impl.java.CompilingClassLoader.<init>(CompilingClassLoader.java:84)
... 7 more
Failed in deploying verticle
java.lang.RuntimeException: Compilation failed
at org.vertx.java.platform.impl.java.CompilingClassLoader.<init>(CompilingClassLoader.java:108)
at org.vertx.java.platform.impl.java.JavaVerticleFactory.createVerticle(JavaVerticleFactory.java:51)
at org.vertx.java.platform.impl.DefaultPlatformManager$21.run(DefaultPlatformManager.java:1723)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:175)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.RuntimeException: Unable to detect java compiler, make sure you're using a JDK not a JRE!
at org.vertx.java.platform.impl.java.CompilingClassLoader.<init>(CompilingClassLoader.java:84)
... 7 more
[root@ip-X mycompany]#
编辑:JDK 已安装。
[root@ip-X mycompany]# rpm -qa |grep java
javapackages-tools-0.9.1-1.2.amzn1.noarch
tzdata-java-2013i-2.23.amzn1.noarch
**java-1.7.0-openjdk-1.7.0.51-2.4.4.1.36.amzn1.x86_64**
[root@ip-X mycompany]#
答案1
如果您已经安装了 JDK 但仍然出现错误,则 JDK 和 JRE 类之间可能存在冲突。
在 jdk 中添加 bin 文件夹的路径(例如:C:\Program Files\Java\jdk1.8.0_20\bin)类路径系统变量。它将解决该问题。
答案2
信息很明确。此软件需要安装 JDK (Java 开发工具包),而不仅仅是 JRE (Java 运行时环境)。
解决方案:安装JDK。
答案3
我在 Windows 上遇到了同样的问题。
当我添加它对我有用JAVA_HOME
时C:\Program Files\Java\jdk1.8.0_51