我正在运行的代码来自http://www.scalafx.org的主页。没有编译器警告但是当它运行时我得到了异常。我首先尝试使用带有Scala 2.11和ScalaFX 2.9.3-2.2.67的jdk 1.7并获得了相同的错误。我仍然使用scala 2.11和ScalaFX 2.11-8.0.20-R6获得jdk 1.8。我希望我愚蠢地错过一些简单的东西。这就是写入控制台的全部内容:
"C:\Program Files (x86)\Java\jdk1.8.0_20\bin\java" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.4\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\deploy.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\javaws.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jfxswt.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\management-agent.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\plugin.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\access-bridge-32.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\cldrdata.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\dnsns.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\jaccess.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\jfxrt.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\localedata.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\nashorn.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunec.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunjce_provider.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunmscapi.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\sunpkcs11.jar;C:\Program Files (x86)\Java\jdk1.8.0_20\jre\lib\ext\zipfs.jar;C:\Program Files (x86)\scala\lib\scala-actors-2.11.0.jar;C:\Program Files (x86)\scala\lib\scala-swing_2.11-1.0.1.jar;C:\Program Files (x86)\scala\lib\scala-library.jar;C:\Users\bhoeppner\Downloads\ScalaFX 8\scalafx_2.11-8.0.20-R6.jar;C:\Users\bhoeppner\Downloads\ScalaFX 8\scalafx_2.11-8.0.20-R6-javadoc.jar;C:\Users\bhoeppner\Downloads\ScalaFX 8\scalafx_2.11-8.0.20-R6-sources.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 13.1.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain HelloStageDemo
Exception in thread "main" java.lang.ClassNotFoundException: HelloStageDemo
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:116)
Process finished with exit code 1
答案 0 :(得分:0)
MarsAtomic和Hot Licks是正确的。这就是我开始工作的方式:
将包含HelloStageDemo的文件拖到src文件夹中,该文件夹已标记为Sources Root。
感谢您直接指导我!