记录一个JavaFX开发过程中遇到的错误, 在此之前JavaFX开发使用的是JDK1.8, 在JDK1.8版本自带了JavaFX的依赖Jar包.

后续需求要用到ARCGIS的技术, 于是找到了 ArcObjects SDK (Java) , 并下载了官方入门Demo按照步骤很快完成了基础配置,但是该项目要求使用JDK11,于是把JDK11也安装了,但是到最后一步运行时却提示了多个错误:

> Task :run
Exception in thread "WindowsNativeRunloopThread" java.lang.NoSuchMethodError: <init>at javafx.graphics/com.sun.glass.ui.win.WinApplication.staticScreen_getScreens(Native Method)at javafx.graphics/com.sun.glass.ui.Screen.initScreens(Screen.java:412)at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:152)at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)at java.base/java.lang.Thread.run(Thread.java:834)
Exception in thread "JavaFX Application Thread" java.lang.NullPointerExceptionat javafx.graphics/com.sun.prism.d3d.D3DPipeline.getAdapterOrdinal(D3DPipeline.java:205)at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.assignScreensAdapters(QuantumToolkit.java:738)at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runToolkit(QuantumToolkit.java:334)at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$startup$10(QuantumToolkit.java:279)at javafx.graphics/com.sun.glass.ui.Application.lambda$run$1(Application.java:153)at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)at java.base/java.lang.Thread.run(Thread.java:834)> Task :run FAILEDFAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':run'.
> Process 'command 'C:\Program Files\Java\jdk-11.0.5\bin\java.exe'' finished with non-zero exit value 1* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 1m 15s
4 actionable tasks: 2 executed, 2 up-to-date
Process 'command 'C:\Program Files\Java\jdk-11.0.5\bin\java.exe'' finished with non-zero exit value 1
18:33:15: Task execution finished 'run'.

错误原因:

同时安装了JDK1.8和JDK11

已知解决方案:

需要卸载掉JDK1.8, 并且将环境变量中的"JAVA_HOME"指向改成JDK11的目录

(此操作会导致原使用JDK1.8构建的JavaFX项目编译失败, 解决方法参考JavaFX官网文档 JavaFX and Intellij -> Non-modular from IDE-> 4. Add VM options)

处理完成后程序完美执行:

JavaFX报错: Exception in thread WindowsNativeRunloopThread java.lang.NoSuchMethodError相关推荐

  1. IDEA运行redis多线程访问报错Exception in thread “main“ java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory

    错误样式: 解决方案: 下载两个JAR包即可,同样的代码我在MyEclipse中运行就不报错,可能是IDEA缺少这两个JAR包吧,而ME本身自带了 托管下载地址:Central Repository: ...

  2. 【亲测有效】如何解决Hadoop运行jar包 报错Exception in thread “main“ java.lang.ClassNotFoundException: /input

    报错解释 字面意思就是我要运行这个jar但是Java无法找到主类 试错过程 你可能会在这里添加主类,但是还是不行.你可能没辙了. 解决办法 <build><finalName> ...

  3. SpringBoot—启动报错Exception in thread “main“ java.lang.ClassNotFoundException

    问题   在微服务启动时,日志排查发现无法启动. 解决方案 查看是否有xxxApplication类. 在pom.xml中查看中的内是否未加xxxApplication类.

  4. springboot启动报错Exception in thread “main“ java.lang.NoClassDefFoundError: io/netty/util/Timer

    原因: 这是缺少netty包的原因. 解决方法: 加入一下依赖: <!-- https://mvnrepository.com/artifact/io.netty/netty-all --> ...

  5. 报错Exception in thread “main“ java.lang.NoClassDefFoundError: javax/xml/bind/...

    项目一开始用的是jdk8,后来重新导入项目没有设置jdk的版本,idea自动设置jdk11 , jdk11没有javax.xml.bind 这个包,需要手动导包: <!-- https://mv ...

  6. hive启动报错:Exception in thread “main“ java.lang.NoSuchMethodError: com.google.common.base.Precondition

    报错如下 Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Precon ...

  7. idea启动springboot时报错Exception in thread “main“ java.lang.UnsupportedClassVersionError:

    idea启动springboot时报错Exception in thread "main" java.lang.UnsupportedClassVersionError:org/s ...

  8. 解决:Exception in thread main java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExe

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 1.报错: Exception in thread "main" java.la ...

  9. IDEA 本地调试spark程序 Exception in thread main java.lang.NoSuchMethodError: scala.collection.immutable.

    1.很简单的一测试程序: 2.run运行时:出现ERROR,报错行显示在  new SparkContext 这行. val sc = new SparkContext(conf) Exception ...

  10. Exception in thread main java.lang.NoSuchMethodError

    Exception in thread "main" java.lang.NoSuchMethodError: scala.Product.initinitinit(Lscala/ ...

最新文章

  1. mysql分表方法-----MRG_MyISAM引擎分表法
  2. 解决Git中fatal: refusing to merge unrelated histories(亲测)
  3. python3----列表
  4. vue-cli3插件初体验
  5. c#中textbox属性_C#.Net中的TextBox.MaxLength属性与示例
  6. 基础正则表达式介绍与练习
  7. WSPBuilder 生成Webpart 部署包
  8. 深入掌握JMS(四):实战Queue
  9. python文件编码转换工具_python实现unicode转中文及转换默认编码的方法
  10. PHP实现简单的计算器
  11. 第四章 Python数据分析-描述性分析
  12. phalcon开发工具(phalcon-devtools)
  13. oc快速生成单例头文件解析
  14. Android基于代理的插件化思路分析
  15. python图表制作方法_python图表制作
  16. 计算机毕业设计ssm基于HTML5的环保公益网站d4sf1系统+程序+源码+lw+远程部署
  17. java-遍历Json
  18. CC2540蓝牙开发一BLE例程
  19. STM32F4+ESP8266拟辉光钟设计(二)WS2812灯光控制
  20. 10个web开发好用框架

热门文章

  1. RuoYi-Vue简介
  2. FC-SAN存储技术
  3. FFmpeg[14] - ffbuild/common.mak:173: *** missing separator. Stop.
  4. 二元二次方程 c语言,C语言求解三元一次方程组的解
  5. 计算机硬盘换,电脑硬盘可以随便换吗
  6. 峰哥建议你要多「旷课」
  7. HDU 4415 Assassin’s Creed 苦逼的贪心
  8. 高德Location
  9. 服务器网站首页被被修改,web服务器被入侵修改内容后如何处理
  10. lg、ln的表示方法