我克隆了这个存储库https://github.com/TomasMikula/RichTextFX
一切都很好,并且intellJ没有抱怨。
然后我尝试在intelliJ中运行CloneDemo(包括参数),这就发生了。有什么想法吗?
Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/fxmisc/richtext/InlineCssTextArea
at org.fxmisc.richtext.demo.CloneDemo.start(CloneDemo.java:24)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Caused by: java.lang.ClassNotFoundException: org.fxmisc.richtext.InlineCssTextArea
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more
intelliJ java arguments -Didea.launcher.port=7536 "-Didea.launcher.bin.path=C:\Users\username\AppData\Roaming\JetBrains\IntelliJ IDEA Community Edition 2016.3.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_121\jre\lib\charsets.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\deploy.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\access-bridge-64.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\cldrdata.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\dnsns.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jaccess.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jfxrt.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\localedata.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\nashorn.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunec.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunjce_provider.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunmscapi.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunpkcs11.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\zipfs.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\javaws.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\jce.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfr.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfxswt.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\jsse.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\management-agent.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\plugin.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\resources.jar C:\Program Files\Java\jdk1.8.0_121\jre\lib\rt.jar C:\Users\username\projects\TestingRandomThings\RichTextFX\richtextfx-demos\build\classes\main C:\Users\username\projects\TestingRandomThings\RichTextFX\richtextfx-demos\build\resources\main C:\Users\username\AppData\Roaming\JetBrains\IntelliJ IDEA Community Edition 2016.3.5\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.fxmisc.richtext.demo.CloneDemo
演示模块的gradle脚本构建了一个fatJar。但是这并没有被intelliJ使用。使用jar运行程序时,它运行没有问题。
java -cp build/libs/richtextfx-demos-fat-1.0.0-SNAPSHOT.jar org.fxmisc.richtext.demo.CloneDemo
答案 0 :(得分:0)
这个问题仍然存在,但JordanMartinez向我展示了解决方法。使用最新版本的intelliJ(2016.3+),可以将构建过程分配给gradle。 gradle可以为您运行课程,如this article。
所示