violetlib/vaqua

Support for java.version with four sub versions

Closed this issue · 8 comments

Hi,

is there any plan to support Java 11?
I tried fixing all the build errors (mostly sun.awt stuff) but wasn't able to get Aqua8MultiResolutionImage to work, since stuff like ImageCache "doesn't exist" anymore.

I'm not sure what you are doing, but I suspect you are not following the supplied build script.
I am able to run VAqua on Java 8 through 15.

I'm including VAqua using the maven central link on the website:

<dependency>
    <groupId>org.violetlib</groupId>
    <artifactId>vaqua</artifactId>
    <version>8</version>
</dependency>

I then call UIManager.setLookAndFeel(AquaLookAndFeel.class.getName()); which fails with:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at MethodInvoker.handleEvent(MethodInvoker.java:31)
	... 40 more
Caused by: java.lang.NoClassDefFoundError: sun/awt/image/MultiResolutionImage
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at org.violetlib.aqua.JavaSupport.findImpl(Unknown Source)
	at org.violetlib.aqua.JavaSupport.<clinit>(Unknown Source)
	at org.violetlib.aqua.AquaLookAndFeel.initialize(Unknown Source)
	at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:586)
	at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:633)
        ... 45 more
Caused by: java.lang.ClassNotFoundException: sun.awt.image.MultiResolutionImage
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 63 more

Which is to be expected because that class only exists in JDK 8 (at least according to search engines).

It should not be loading those classes if you are not on JDK 8, so my first guess is that it is misunderstanding the java.version string. See AquaUtils.obtainJavaVersion.

When running the method in jshell on azul openjdk 11.0.9.1 2020-11-04 LTS, java.version is "11.0.9.1" and the method returns 0.

Thanks. I have made a simpler fix that is probably adequate, which is to ignore the extra component(s). I can't see putting in any patches that are that more specific than a three component version.

That sounds even better.

Is the fix already released?

No, it will be in the next release, should be soon.