我正在使用IntelliJ社区版2016.1,只有一个文件' test.java'在src文件夹中。
每当我编译或制作项目时,我都会收到以下错误。出了什么问题? 不幸的是,谷歌没有任何可能出现问题的信息。
Information:Using javac 9-ea to compile java sources
Information:java: An exception has occurred in the compiler (9-ea). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
Information:java: at com.sun.tools.javac.code.ModuleFinder.findSingleModule(jdk.compiler@9-ea/ModuleFinder.java:223)
Information:java: at com.sun.tools.javac.comp.Modules.setCompilationUnitModules(jdk.compiler@9-ea/Modules.java:347)
Information:java: at com.sun.tools.javac.comp.Modules.enter(jdk.compiler@9-ea/Modules.java:205)
Information:java: at com.sun.tools.javac.main.JavaCompiler.initModules(jdk.compiler@9-ea/JavaCompiler.java:1020)
Information:java: at com.sun.tools.javac.main.JavaCompiler.initModules(jdk.compiler@9-ea/JavaCompiler.java:1012)
Information:java: at com.sun.tools.javac.main.JavaCompiler.compile(jdk.compiler@9-ea/JavaCompiler.java:906)
Information:java: at com.sun.tools.javac.api.JavacTaskImpl$1.call(jdk.compiler@9-ea/JavacTaskImpl.java:104)
Information:java: at com.sun.tools.javac.api.JavacTaskImpl$1.call(jdk.compiler@9-ea/JavacTaskImpl.java:100)
Information:java: at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(jdk.compiler@9-ea/JavacTaskImpl.java:135)
Information:java: at com.sun.tools.javac.api.JavacTaskImpl.doCall(jdk.compiler@9-ea/JavacTaskImpl.java:100)
Information:java: at com.sun.tools.javac.api.JavacTaskImpl.call(jdk.compiler@9-ea/JavacTaskImpl.java:94)
Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:168)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:388)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:289)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:197)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:168)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1238)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:912)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:984)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:871)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:696)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:387)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:194)
Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:137)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:294)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
Information:java: at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:44)
Information:java: at java.util.concurrent.Executors$RunnableAdapter.call(java.base@9-ea/Executors.java:514)
Information:java: at java.util.concurrent.FutureTask.run(java.base@9-ea/FutureTask.java:266)
Information:java: at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@9-ea/ThreadPoolExecutor.java:1158)
Information:java: at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@9-ea/ThreadPoolExecutor.java:632)
Information:java: at java.lang.Thread.run(java.base@9-ea/Thread.java:804)
Information:java: Caused by: java.io.FileNotFoundException: Java resource does not exist : SOURCE_PATH/SOURCE/module-info
Information:java: at org.jetbrains.jps.javac.JavacFileManager.getJavaFileForInput(JavacFileManager.java:180)
Information:java: at com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager.getJavaFileForInput(jdk.compiler@9-ea/ClientCodeWrapper.java:287)
Information:java: at com.sun.tools.javac.code.ModuleFinder.getModuleInfoFromLocation(jdk.compiler@9-ea/ModuleFinder.java:231)
Information:java: at com.sun.tools.javac.code.ModuleFinder.findSingleModule(jdk.compiler@9-ea/ModuleFinder.java:187)
Information:java: ... 32 more
Information:java: Errors occurred while compiling module 'untitled'
Information:10/4/16 10:45 PM - Compilation completed with 1 error and 0 warnings in 5s 756ms
Error:java: java.lang.Error: java.io.FileNotFoundException: Java resource does not exist : SOURCE_PATH/SOURCE/module-info
答案 0 :(得分:1)
您必须使用您的模块定义在src目录中创建module-info.java文件。
请参阅:http://openjdk.java.net/projects/jigsaw/spec/sotms/#module-declarations
示例:
module com.foo.bar { }
答案 1 :(得分:0)
我通过简单地改为Java 8来解决这个问题,正如Jesper在评论中所建议的那样。看起来IntelliJ目前不支持Java 9。
答案 2 :(得分:0)
它对我有用。我正在使用 IntelliJ IDEA 2016.1.1 与 JDK 9 build 116
您需要在 src 创建 module-info.java 。请参阅以下内容:
\ SRC \ module-info.java
module com.bsingh.java9 { }
\ SRC \ COM \ bsingh \ java9 \ Java9Main.java
package com.bsingh.java9;
public class Java9Main {
public static void main(String[] args) {
System.out.println("Hello Java 9 !!!");
}
}
然后运行Java9Main。您将看到输出:
Hello Java 9 !!!