简体   繁体   English

无法在 Ubuntu 中安装 CPUSim

[英]Unable to install CPUSim in Ubuntu

I need to run CPUSim Version 4 for a project in my university.我需要为我大学的一个项目运行 CPUSim 版本 4。 Upon following the directions given by the website and the README.md , I receive this error:按照网站和README.md给出的说明进行README.md ,我收到此错误:

java -cp .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar -jar CPUSim-4.0.11.jar

This gave me the following error:这给了我以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at cpusim.Main.main(Main.java:73)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 10 more

I've browsed forums and tried to install openjfx but it didn't work.我浏览了论坛并尝试安装 openjfx 但它没有用。 I tried to download the JavaFX runtime and run it using this command:我尝试下载 JavaFX 运行时并使用以下命令运行它:
java --module-path $JFX --add-modules javafx.controls -cp .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar -jar CPUSim-4.0.11.jar which resulted in this: java --module-path $JFX --add-modules javafx.controls -cp .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar -jar CPUSim-4.0.11.jar这导致了这个:

Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: javafx/fxml/Initializable
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at cpusim.GUIMain.start(GUIMain.java:50)
        at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
        at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
        at javafx.graphics/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:277)
        ... 1 more
Caused by: java.lang.ClassNotFoundException: javafx.fxml.Initializable
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 19 more

Now I'm clueless as to what to do, I'm just trying to get this to run.现在我不知道该怎么做,我只是想让它运行。 None of this makes sense to me at the moment.目前这些对我来说都没有意义。 Any help will be appreciated.任何帮助将不胜感激。

my java version:我的Java版本:

openjdk 11.0.8 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

Here:这里:

Caused by: java.lang.ClassNotFoundException: javafx.fxml.Initializable引起:java.lang.ClassNotFoundException:javafx.fxml.Initializable

Basically tells you: the javax stuff is missing.基本上告诉你:缺少 javax 的东西。

Thing is: getting javafx to work on some Linux distribution is actually tricky, as there are so many different ways the distributions/JDK packages "deliver" JavaFX.问题是:让 javafx 在某些 Linux 发行版上工作实际上很棘手,因为发行版/JDK 包“交付”JavaFX 的方式有很多。

I suggest you turn to here to find out what exactly your environment needs.我建议您转至此处以了解您的环境到底需要什么。

It appears from the stack trace that you are using FXML for your application.从堆栈跟踪中可以看出您正在为您的应用程序使用 FXML。 The javafx.fxml package is in a separate module (with the same name as the package) to the controls, so you also need to include that on the command line: javafx.fxml包位于控件的单独模块(与包同名)中,因此您还需要在命令行中包含它:

java --module-path $JFX --add-modules javafx.controls,javafx.fxml -cp  .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar -jar CPUSim-4.0.11.jar 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM