Lymia/MPPatch

Don't use non-public APIs for accessing the registery on Windows.

ldbennett3 opened this issue · 3 comments

Getting this when running the jar through console to get it to run. For some reason running the .exe has no effect. It just makes a log file and does nothing else.

C:\Users\doomm\Downloads>java -jar mppatch-0.1.3.jar

================================================================================
MPPatch version 0.1.3
Revision 8adb8b7, built on May 8, 2021 by jenkins@himawari

Build ID : 3e5748f5-a000-46d0-87d3-cd86ca811320
Build Date : 2021-05-08T12:40:07Z
Revision : 8adb8b7
Tree Status:

[2022-11-10T02:55:11Z/ INFO] Changing patch package...
Exception in thread "main" java.lang.NoSuchMethodError: Non-existent method WindowsRegOpenKey in java.util.prefs.WindowsPreferences was accessed.
at moe.lymia.mppatch.util.win32.DynamicReflectiveProxy.applyDynamic(DynamicReflectiveProxy.scala:100)
at moe.lymia.mppatch.util.win32.WindowsRegistry$.moe$lymia$mppatch$util$win32$WindowsRegistry$$withKey(WindowsRegistry.scala:37)
at moe.lymia.mppatch.util.win32.WindowsRegistry$RegistryStringKey$.readKey(WindowsRegistry.scala:53)
at moe.lymia.mppatch.util.win32.WindowsRegistry$Hive.readKey(WindowsRegistry.scala:72)
at moe.lymia.mppatch.util.win32.WindowsRegistry$Hive.apply(WindowsRegistry.scala:73)
at moe.lymia.mppatch.core.Win32Platform$.defaultSystemPaths(platform.scala:75)
at moe.lymia.mppatch.ui.MainFrame.pathFromRegistry(MainFrame.scala:91)
at moe.lymia.mppatch.ui.MainFrame.(MainFrame.scala:102)
at moe.lymia.mppatch.ui.InstallerMain.main(Installer.scala:77)
at moe.lymia.mppatch.ui.Installer$.main(Installer.scala:89)
at moe.lymia.mppatch.ui.Installer.main(Installer.scala)

Lymia commented

Erk... This is definitely a case of my poor past design choices coming back to bite me. I don't currently have the time to work on this, but I'll try to get a new version out sometime within a week or two. For now, try using Java 8.

Erk... This is definitely a case of my poor past design choices coming back to bite me. I don't currently have the time to work on this, but I'll try to get a new version out sometime within a week or two. For now, try using Java 8.

Running it via the Java 8 JRE worked good and patch installed, I was previously using 17.0.4
.exe version still never worked for me though. Currently running Windows 10 Pro version 21H2

It appears that these issues stem from the same problem:
#66
#69

Should the system have a Java SDK installed (as well as JRE 8) then app would run under newer SDK java by default and encounter these issues, silently crashing.

The WindowsRegOpenKey method no longer accepts the parameters (int, byte[], int), but (long, byte[], int), amongst other issues.

The fix is to modify project/launch4j.xml and add "<maxVersion>1.8.1</maxVersion>" (This will have EXE run at 1.8.0 rather than 17.0 or what not). Built and tested for my windows system, seems to work.

When running the Jar directly just mandate JRE 8 I suppose, otherwise have to fix several other bugs.