我有Ubuntu 16.04。我根据官方的 bazel 指南下载并安装了 bazel,之后我下载了第一个构建 Java 项目的教程,但它不起作用。我得到了这个例外:
unexpected pipe read status: (error: 2): No such file or directory
Server presumed dead. Now printing '/home/jingw222/.cache/bazel/_bazel_jingw222/ada033fd33c06190d78b77ab4907f1d0/server/jvm.out':
java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:141)
at java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:130)
at com.google.devtools.build.lib.skyframe.SkyframeExecutor.skyFunctions(SkyframeExecutor.java:348)
at com.google.devtools.build.lib.skyframe.SkyframeExecutor.init(SkyframeExecutor.java:586)
at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.init(SequencedSkyframeExecutor.java:252)
at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.create(SequencedSkyframeExecutor.java:211)
at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.create(SequencedSkyframeExecutor.java:162)
at com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutorFactory.create(SequencedSkyframeExecutorFactory.java:48)
at com.google.devtools.build.lib.runtime.WorkspaceBuilder.build(WorkspaceBuilder.java:81)
at com.google.devtools.build.lib.runtime.BlazeRuntime.initWorkspace(BlazeRuntime.java:204)
at com.google.devtools.build.lib.runtime.BlazeRuntime.newRuntime(BlazeRuntime.java:1023)
at com.google.devtools.build.lib.runtime.BlazeRuntime.createBlazeRPCServer(BlazeRuntime.java:850)
at com.google.devtools.build.lib.runtime.BlazeRuntime.serverMain(BlazeRuntime.java:789)
at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:570)
at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:56)
Caused by: java.lang.ClassCastException: com.ibm.lang.management.UnixExtendedOperatingSystem incompatible with com.sun.management.OperatingSystemMXBean
at com.google.devtools.build.lib.util.ResourceUsage.<clinit>(ResourceUsage.java:45)
... 13 more
什么可以解决问题?
我发现了这个问题,最后我意识到,我需要手动下载 jdk。所以我使用了这个命令:
sudo apt-get install openjdk-8-jdk
之后我再次构建它,它运行良好。