gpt4 book ai didi

java - 应用程序在 netbeans 中工作,但分发 jar 不工作

转载 作者:行者123 更新时间:2023-11-29 09:00:04 25 4
gpt4 key购买 nike

我从 netbeans 创建了一个可执行 jar。单击 jar 不起作用。所以我在命令行中使用了以下命令:java -jar "TestEye.jar"来查看任何问题。

这一定是 netbeans 中的设置问题。如果你有解决方案。我将不胜感激。

Catched FileNotFoundException: 
C:\Users\Engineer101\Documents\NetBeansProjects\TestEye\dist\lib\gluegen-rt-natives-windows-
amd64.jar
(The system cannot find the file specified), while TempJarCache.bootstrapNativeLib() of
jar:file:/C:/Users/Engineer101/Documents/NetBeansProjects/TestEye/dist/lib/gluegen-rt-natives
windows-amd64.jar!/ (file:/C:/Users/Engineer101/Documents/NetBeansProjects/TestEye
/dist/lib/ + gluegen-rt-natives-windows-amd64.jar)


Exception in thread "main" java.lang.UnsatisfiedLinkError: no gluegen-rt in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:442)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:59)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary
(JNILibLoaderBase.java:90)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:328)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary
(DynamicLibraryBundle.java:390)
at com.jogamp.common.os.Platform.loadGlueGenRTImpl(Platform.java:251)
at com.jogamp.common.os.Platform.access$000(Platform.java:57)
at com.jogamp.common.os.Platform$1.run(Platform.java:186)
at com.jogamp.common.os.Platform$1.run(Platform.java:183)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:183)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:82)
at gov.nasa.worldwind.Configuration.getMaxCompatibleGLProfile
(Unknown Source)
at gov.nasa.worldwind.awt.WorldWindowGLCanvas.getCaps(Unknown Source)
at gov.nasa.worldwind.awt.WorldWindowGLCanvas.<init>(Unknown Source)
at gov.nasa.worldwindx.examples.ApplicationTemplate$AppPanel.createWorld
Window(Unknown Source)
at gov.nasa.worldwindx.examples.ApplicationTemplate$AppPanel.<init>
(Unknown Source)
at gov.nasa.worldwindx.examples.ApplicationTemplate$AppFrame.
createAppPanel(Unknown Source)
at gov.nasa.worldwindx.examples.ApplicationTemplate$AppFrame.initialize
(Unknown Source)
at gov.nasa.worldwindx.examples.ApplicationTemplate$AppFrame.<init>
(Unknown Source)
at TestEye.TestEye$AppFrame.<init>(TestEye.java:75)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at gov.nasa.worldwindx.examples.ApplicationTemplate.start
(Unknown Source)
at TestEye.TestEye.main(TestEye.java:209)

最佳答案

仔细检查项目中使用的所有 jar 文件是否包含在项目 jar 文件之后的 dist/lib 文件夹中已经建成。看看下面 dist 文件夹中的 README.TXT:

When you build an Java application project that has a main class, the IDE automatically copies all of the JAR files on the projects classpath to your projects dist/lib folder. The IDE also adds each of the JAR files to the Class-Path element in the application JAR files manifest file (MANIFEST.MF).

To run the project from the command line, go to the dist folder and type the following:

java -jar [project-name].jar

To distribute this project, zip up the dist folder (including the lib folder) and distribute the ZIP file.

Notes:

  • If two JAR files on the project classpath have the same name, only the first JAR file is copied to the lib folder.
  • Only JAR files are copied to the lib folder. If the classpath contains other types of files or folders, these files (folders) are not copied.
  • If a library on the projects classpath also has a Class-Path element specified in the manifest,the content of the Class-Path element has to be on the projects runtime path.
  • To set a main class in a standard Java project, right-click the project node in the Projects window and choose Properties. Then click Run and enter the class name in the Main Class field. Alternatively, you can manually type the class name in the manifest Main-Class element.

祝你好运!

关于java - 应用程序在 netbeans 中工作,但分发 jar 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17987767/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com