Windows7下ldraw2sunflow运行失败,报索引越界等错误求助
Let’s work through the two key problems in your error log to get the app running again:
1. Resolve the Windows Registry Permission Warning
The first error is a common permission hiccup on Windows 7 for Java apps that use system preferences:
Jan 31, 2018 3:27:49 PM java.util.prefs.WindowsPreferences
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
Error code 5 means "access denied"—here’s how to fix it:
- Press
Win + R, typeregedit, and hit Enter to open the Registry Editor. - Navigate to
HKEY_LOCAL_MACHINE\Software\JavaSoft. - Right-click the
JavaSoftfolder, select Permissions. - Find your user account in the list, check the Write (or Full Control) box under "Allow", then click Apply > OK.
- Alternatively, you can test launching ldraw2sunflow by right-clicking its shortcut/JAR file and selecting Run as administrator to bypass the permission check temporarily.
2. Fix the StringIndexOutOfBoundsException
The second crash is triggered by a broken string operation, almost certainly caused by corrupted preferences from the first issue:
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.PartF...
To reset the app’s corrupted settings:
- Open the Registry Editor again (as above).
- Navigate to either
HKEY_LOCAL_MACHINE\Software\JavaSoft\Prefs\org\ldraw2sunfloworHKEY_CURRENT_USER\Software\JavaSoft\Prefs\org\ldraw2sunflow(whichever exists). - Right-click the
ldraw2sunflowfolder and select Delete to wipe the broken preferences. - If the app stores local config files, check your user directory (e.g.,
C:\Users\[YourName]\.ldraw2sunflowor similar) for any preference files, delete them, and restart the app. - If the problem sticks around, try re-downloading the ldraw2sunflow JAR file and replacing your current copy—this ensures you’re working with a clean, uncorrupted version.
After completing these steps, launch ldraw2sunflow again—it should start fresh with default settings and no more errors.
内容的提问来源于stack exchange,提问作者posfan12

