我正在尝试在 Windows 7 上使用一个名为“ldraw2sunflow”的 Java 应用程序。它可以在两种 3D 模型格式之间进行转换。该程序的描述如下这里不管怎样,我第一次尝试时该程序运行了,但现在却停止运行了。
这很奇怪,因为程序有过去运行正常。
错误如下:
Jan 31, 2018 3:27:49 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0
x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Jan 31, 2018 3:27:49 PM org.ldraw2sunflow.ui.Ldraw2Sunflow <init>
INFO: en_US
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at org.ldraw2sunflow.util.PartFinder.loadColor(PartFinder.java:274)
at org.ldraw2sunflow.util.PartFinder.setLDRAWDIR(PartFinder.java:172)
at org.ldraw2sunflow.ui.impl.LDrawPanel.initPreferences(LDrawPanel.java:122)
at org.ldraw2sunflow.ui.impl.LDrawPanel.<init>(LDrawPanel.java:47)
at org.ldraw2sunflow.ui.Ldraw2Sunflow.<init>(Ldraw2Sunflow.java:80)
at org.ldraw2sunflow.ui.Ldraw2Sunflow.lambda$main$10(Ldraw2Sunflow.java:114)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
两个问题:
- 导致错误的原因是什么?
- 我可以在没有源代码的情况下解决这个问题吗?
谢谢。
[编辑]
这是我的命令行:"C:\Program Files\Java\jre1.8.0_161\bin\java.exe" -Xmx1G -jar "E:\Programs Windows\LDraw\LDraw2Sunflow_f\ldraw2sunflow.jar"
[编辑]
我怀疑这是某种注册表问题,因为当我使用 regedit 删除“HKEY_USERS\S-1-5-21-2113055238-2099637611-63920502-1003\Software\JavaSoft\Prefs\org”时,程序将重新启动。但是,当我重新启动程序时,存储库路径丢失了,因此我必须再次输入它们。(每次我停止/启动程序时,都要一遍又一遍地输入。)
实际的程序现在在其他地方失败了:
Exception in thread "Thread-4" java.lang.UnsatisfiedLinkError: no lwjgl 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 org.lwjgl.LWJGLUtil.loadLibrarySystem(LWJGLUtil.java:337)
at org.lwjgl.Sys.<clinit>(Sys.java:29)
at org.ldraw2sunflow.lwjgl.PreviewOpenGL.run(PreviewOpenGL.java:160)
at org.ldraw2sunflow.ui.impl.RenderPanel.convertFile(RenderPanel.java:11
7)
at org.ldraw2sunflow.ui.impl.RenderPanel.access$000(RenderPanel.java:61)
at org.ldraw2sunflow.ui.impl.RenderPanel$1.run(RenderPanel.java:85)
答案1
这是已知的 Java 问题。
1.第一步:
如果你像这样运行你的程序:
java -jar ldraw2sunflow.jar
添加两个文件的完整路径,例如:
/usr/java/<version>/bin/java -jar /home/<username>/Downloads/ldraw2sunflow.jar
2.第二步:
对于 Windows 7:
- 启动“控制面板”
- 点击“默认程序”
- 点击“将文件类型或协议与特定程序关联”
- 双击。罐
- 浏览 C:\Program Files\Java\jre1.8.0_161\bin\javaw.exe
- 点击按钮打开
- 点击按钮确定
3.最后一步:
转变罐到EXE文件. 无论如何你需要执行环境运行它,但它将 100% 可运行。此类转换器有很多变体。以前我用jar转exe。