I cloned this repo and I am trying to compile it because the releases dont work despite it working for everyone else I have talked to. The problem is when I compile it and run it, I get this error.
Exception in thread "main" java.lang.NoClassDefFoundError: com/alee/laf/WebLookAndFeel
at me.grax.jbytemod.res.LanguageRes.fixUnicodeSupport(LanguageRes.java:33)
at me.grax.jbytemod.res.LanguageRes.<init>(LanguageRes.java:27)
at me.grax.jbytemod.JByteMod.initialize(JByteMod.java:173)
at me.grax.jbytemod.JByteMod.main(JByteMod.java:222)
Caused by: java.lang.ClassNotFoundException: com.alee.laf.WebLookAndFeel
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 4 more
However, when I actually go to the fixUnicodeSupport() method, I dont get any errors inside of InteillJ. The method looks like the following but when I click on WebLookAndFeel
and click go-to it takes me to the class.
private void fixUnicodeSupport() {
for (String translation : map.values()) {
for (char c : translation.toCharArray()) {
if (!WebLookAndFeel.globalControlFont.canDisplay(c)) {
WebLookAndFeel.globalControlFont = fixFont(WebLookAndFeel.globalControlFont);
WebLookAndFeel.globalTooltipFont = fixFont(WebLookAndFeel.globalTooltipFont);
WebLookAndFeel.globalAlertFont = fixFont(WebLookAndFeel.globalAlertFont);
WebLookAndFeel.globalMenuFont = fixFont(WebLookAndFeel.globalMenuFont);
WebLookAndFeel.globalAcceleratorFont = fixFont(WebLookAndFeel.globalAcceleratorFont);
WebLookAndFeel.globalTitleFont = fixFont(WebLookAndFeel.globalTitleFont);
WebLookAndFeel.globalTextFont = fixFont(WebLookAndFeel.globalTextFont);
JByteMod.LOGGER.log("Updated WebLaF fonts for unicode support");
return;
}
}
}
JByteMod.LOGGER.log("Unicode check finished!");
}
This project contains the weblaf-complete-1.29-fixed.jar
inside the lib folder and I even changed its maven path to the hard coded path which I know exists and everything does compile fine, but I still get that error. I then decided to go into Project Structure -> Libraries and then add the lib to that (which is how you normally do it without maven) but that also did not work. So why exactly am I getting a class not found error when its clearly there since I can visit the class and InteilJ does not show any errors which normally happens when a class is actually missing.
Edit:
I even tried to add the following resource to my pom (the pom is linked above) which does increase the jar's size (since it now included the libs) but I still get the same error.
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>lib/*.jar</include>
</includes>
</resource>
Edit 2:
My environment variables are set to jdk 8 (both user and for system). However, when I instead run this jar file by doing "C:\Program Files\Java\jdk1.8.0_291\bin\java.exe" -jar JByteMod-Remastered-2.1.4.jar
which ensures it is ran with Java 8 I now get a new error.
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/attach/VirtualMachine
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
I am not sure why this is happening, but I know attach
which is used for hooking vm's in Java has been removed after Java 8 but I already checked, and that jar is still inside my jdk 8. I also included attach-1.7
inside my lib folder which should be shaded into the final jar file. I also know that JNI allows java to access native interfaces and use code from C++ and vis versa. But that does not exactly help me determine what is causing this error.