ikvm icon indicating copy to clipboard operation
ikvm copied to clipboard

Headless AWT Support

Open GeorgeS2019 opened this issue 2 years ago • 11 comments

I understand there is no java.awt UI.

I wonder if the image part can be included?

---> System.NullReferenceException: Object reference not set to an instance of an object. at IKVM.Java.Externs.java.lang.Class.forName0(String name, Boolean initialize, ClassLoader loader, Class caller) at java.lang.Class.forName0(String name, Boolean initialize, ClassLoader loader, Class caller) at java.lang.Class.forName(String className, CallerID ) at java.awt.GraphicsEnvironment.createGE() at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment() at java.awt.image.BufferedImage.createGraphics()

GeorgeS2019 avatar Mar 12 '23 12:03 GeorgeS2019

Correct. The AWT stuff is non functional.

wasabii avatar Mar 14 '23 16:03 wasabii

Headless graphics should be working and enabled by default though. I don't see an open bug for that specifically, so I'll leave this as it.

wasabii avatar Mar 14 '23 16:03 wasabii

AWT related stuff isn't my focus at present. This is an open source project, feel free to contribute.

wasabii avatar Mar 14 '23 22:03 wasabii

Headless graphics should be working and enabled by default though. I don't see an open bug for that specifically, so I'll leave this as it.

wasabii avatar Apr 22 '23 17:04 wasabii

Reopened, again.

wasabii avatar Apr 27 '23 21:04 wasabii

The posted stack-trace is because the property java.awt.graphicsenv is not set (and thus null) On JVM (on windows) this value is set to sun.awt.Win32GraphicsEnvironment however that class appears to be absent in IKVM

On IKVM you instead have ikvm.awt.NetGraphicsEnvironment, located in the IKVM.AWT.WinForms project. IKVM.AWT.WinForms however doesn't seem to be compiled as part of build and thus not included and can't be used.

TheLastRar avatar Jun 02 '23 10:06 TheLastRar

@TheLastRar This is correct. The ikvm.awt code isn't included. It was a old hand-done attempt at an AWT layer against System.WinForms. Neither finished, nor cross platform., nor would it work in Core.

The ultimate goal I have is to finish up feature/nativelib, and include the actual OpenJDK AWT support.

wasabii avatar Jun 07 '23 20:06 wasabii

The ultimate goal I have is to finish up feature/nativelib, and include the actual OpenJDK AWT support.

It is now close to a further 8 months. Thanks for so much progress has been made and now the Microsoft team showing interest. Any crystal ball estimation of when the support for OpenJDK AWT would start?

GeorgeS2019 avatar Feb 18 '24 11:02 GeorgeS2019

This will be done in a couple of weeks https://github.com/ikvmnet/ikvm/issues/381#issuecomment-2065922797

GeorgeS2019 avatar Apr 19 '24 07:04 GeorgeS2019

I did easy adaptation of AWT.WinForms library https://github.com/DjArt/IKVM.AWT.WinForms

DjArt avatar May 14 '24 14:05 DjArt

@DjArt Thx for sharing

I tested, the headless mode using IKVM 8.8.0 FINALLY work!

GeorgeS2019 avatar May 14 '24 19:05 GeorgeS2019

AWT support merged into develop branch.

wasabii avatar May 26 '24 14:05 wasabii