JavaFX8 - 在 NetBeans 8 中找不到 sun.util.logging.PlatformLogger 异常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22562797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 16:30:31  来源:igfitidea点击:

JavaFX8 - sun.util.logging.PlatformLogger not found Exception in NetBeans 8

javanetbeansjavafx-8netbeans-8

提问by A J Qarshi

I have recently installed JDK8 + Netbeans8 (downloaded the bundled setup from Oracle site) on my Windows 8.1 machine.

我最近在我的 Windows 8.1 机器上安装了 JDK8 + Netbeans8(从 Oracle 站点下载了捆绑设置)。

When I create a very simple JavaFX FXML application, it works fine. However when I add a new database entity class using the wizard and compile it, I get following stack trace:

当我创建一个非常简单的 JavaFX FXML 应用程序时,它工作正常。但是,当我使用向导添加新的数据库实体类并编译它时,我得到以下堆栈跟踪:

Note: Creating non-static metadata factory ...
error: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for sun.util.logging.PlatformLogger not found


An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for sun.util.logging.PlatformLogger not found
at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access00(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1173)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:859)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.main.Main.compile(Main.java:381)
at com.sun.tools.javac.main.Main.compile(Main.java:370)
at com.sun.tools.javac.main.Main.compile(Main.java:361)
at com.sun.tools.javac.Main.compile(Main.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1153)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:930)
at org.netbeans.modules.java.source.ant.JavacTask.execute(JavacTask.java:145)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for sun.util.logging.PlatformLogger not found
C:\Users\AJQ\Documents\NetBeansProjects\JavaFX8App\nbproject\jfx-impl.xml:3438: The following error occurred while executing this line:
C:\Users\AJQ\Documents\NetBeansProjects\JavaFX8App\nbproject\build-impl.xml:924: The following error occurred while executing this line:
C:\Users\AJQ\Documents\NetBeansProjects\JavaFX8App\nbproject\build-impl.xml:264: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)

However, if I comment out the annotations in the entity class or change the target platform from 1.8 to 1.7, application gets compiled without any issue.

但是,如果我注释掉实体类中的注释或将目标平台从 1.8 更改为 1.7,则应用程序编译时不会出现任何问题。

Is it some bug in NetBeans 8 or some other configuration issue?

是 NetBeans 8 中的一些错误还是其他一些配置问题?

采纳答案by imolero

I have the same platform (netbeans 8.0 and JDK 8), searching in other project (build in netbeans 7.4 and JDK 7) I found a little difference in the project.properties file, search it in <>/nbproject, look for the line:

我有相同的平台(netbeans 8.0和JDK 8),在其他项目中搜索(在netbeans 7.4和JDK 7中构建)我发现project.properties文件有点不同,在<>/nbproject中搜索,寻找行:

javac.processorpath=\
    ${javac.classpath}:\
    ${libs.eclipselinkmodelgen.classpath}

and change the text to finally be the following:

并将文本更改为最终如下:

javac.processorpath=\
    ${javac.classpath}

thats all, I don't know if it's a bug in netbeans 8 or maybe it's something wrong in the way to make the project, but this fix work for me, more details in this blog entry(spanish version)

就是这样,我不知道这是否是 netbeans 8 中的错误,或者可能是制作项目的方式有问题,但是此修复程序对我有用,此博客条目中的更多详细信息(西班牙语版本)

回答by José Castillo

I got the same error, I checked what imolero said at the project.property file and is exactly as he said is the solution, so I have to change nothing in it.

我遇到了同样的错误,我检查了 imolero 在 project.property 文件中所说的内容,并且正如他所说的那样是解决方案,所以我必须对其进行任何更改。

I realized that each time I worked in a JavaFX project the java files are not compiled automatically when save the file, so I made manually (F9), and re-run the project and every thing works fine. I tried to set Compile on Save in the project properties, but is shadowed, that′s the reason that I have to do it manually. My enviroment is: Windows 7 Professional 64 bits, JDK 1.8.0, Netbeans 8.0 (Build 201403101706)

我意识到每次我在 JavaFX 项目中工作时,java 文件在保存文件时不会自动编译,所以我手动(F9),然后重新运行项目,一切正常。我试图在项目属性中设置 Compile on Save ,但被隐藏了,这就是我必须手动完成的原因。我的环境是:Windows 7 Professional 64 位、JDK 1.8.0、Netbeans 8.0(内部版本 201403101706)

回答by Martin

For Maven projects, setting the bootclasspath for the compiler plugin fixes the problem:

对于 Maven 项目,设置编译器插件的 bootclasspath 可以解决问题:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <compilerArguments>
                    <bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
                </compilerArguments>
            </configuration>
        </plugin>
    </plugins>
</build>

回答by Lalith J.

  1. Right Click on the project and select "Properties".
  2. Select "Libraries" from opened "Project Properties window".
  3. Select "Processor" tab.
  4. Remove EclipseLink from there.
  5. Apply the changes and do a Clean Build.
  1. 右键单击项目并选择“属性”。
  2. 从打开的“项目属性窗口”中选择“”。
  3. 选择“处理器”选项卡。
  4. 从那里删除 EclipseLink。
  5. 应用更改并执行Clean Build

That's it. :)

就是这样。:)