Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Apple JWT Java VM Issue #1

Copy link
Copy link
@bcelenza

Description

@bcelenza
Issue body actions

Hello,

First off, thank you very much for authoring this package. Tremendous job.

I'm working on a particularly tricky piece of code that involves using the java AWT. I'm currently getting an error while trying to read a file using the javax.imageio.ImageIO class. Here's the offending code:

var file = java.newInstanceSync("java.io.File", path);
var image = java.callStaticMethodSync("javax.imageio.ImageIO", "read", file);

The error thrown is:

Error: Error running static method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Caused by: java.lang.InternalError: Can't start the AWT because Java was started on the first thread. Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1724)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.java2d.Disposer.(Disposer.java:41)
at javax.imageio.stream.FileImageInputStream.(FileImageInputStream.java:82)
at javax.imageio.stream.FileImageInputStream.(FileImageInputStream.java:57)
at com.sun.imageio.spi.FileImageInputStreamSpi.createInputStreamInstance(FileImageInputStreamSpi.java:37)
at javax.imageio.ImageIO.createImageInputStream(ImageIO.java:331)
at javax.imageio.ImageIO.read(ImageIO.java:1278)
... 4 more

Any idea how I might be able to get around this?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.