jrw77 / Clip2DataUrl

Converts clipboard content to a data URL on the clipboard
0 stars 0 forks source link

macOS Ventura: exceptions thrown #1

Open 607011 opened 1 year ago

607011 commented 1 year ago

Calling java -jar Clip2DataUrl.jar gives:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:110)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.ClassCastException: class sun.awt.image.MultiResolutionCachedImage cannot be cast to class java.awt.image.BufferedImage (sun.awt.image.MultiResolutionCachedImage and java.awt.image.BufferedImage are in module java.desktop of loader 'bootstrap')
    at clip2dataurl.ClipToDataUrl.getImageFromClipboard(ClipToDataUrl.java:83)
    at clip2dataurl.ClipToDataUrl.main(ClipToDataUrl.java:45)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    ... 2 more

This happens with both an image file and image data in the clipboard. Converting plain/text in clipboard works as expected. Tested with macOS Ventura 13.3.1.

jrw77 commented 1 year ago

Fixed (hopefully) with multi-version jar which should also work on MacOS with java9+. MacOS with java 8 will still throw an error.