gpt4 book ai didi

java - IntelliJ 无法编译为 "Java resource does not exist"

转载 作者:行者123 更新时间:2023-11-30 10:46:29 25 4
gpt4 key购买 nike

我在 src 文件夹中使用 IntelliJ 社区版 2016.1 和单个文件“test.java”。

每当我编译或制作项目时,我都会收到以下错误。出了什么问题?遗憾的是,Google 上没有关于可能出现问题的信息。

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

最佳答案

您必须使用您的模块定义在 src 目录中创建 module-info.java 文件。

参见:http://openjdk.java.net/projects/jigsaw/spec/sotms/#module-declarations

例子:

module com.foo.bar { }

关于java - IntelliJ 无法编译为 "Java resource does not exist",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36532966/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com