Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWT Headless Exception with ImageJ. #542

Closed
BiologyTools opened this issue Jun 22, 2024 · 6 comments
Closed

AWT Headless Exception with ImageJ. #542

BiologyTools opened this issue Jun 22, 2024 · 6 comments

Comments

@BiologyTools
Copy link

BiologyTools commented Jun 22, 2024

I'm trying to run ImageJ (ij.jar) using IKVM 8.8.1 but whenever I try to launch ImageJ I get the following error even when I set ImageJ to launch in headless mode or in normal mode.

using ij;
namespace FijiTest
{
    public partial class Form1 : Form
    {
        public Form1(string[] args)
        {
            InitializeComponent();
            var ijp = new ImageJ();
        }
    }
}

Here is the error I get.

java.awt.HeadlessException
  HResult=0x80131500
  Message=
  Source=IKVM.Java
  StackTrace:
   at java.awt.GraphicsEnvironment.checkHeadless()
   at java.awt.Window..ctor()
   at java.awt.Frame..ctor(String title)
   at ij.ImageJ..ctor(Applet applet, Int32 mode) in ImageJ.java:line 148
   at ij.ImageJ..ctor() in ImageJ.java:line 132
   at FijiTest.Form1..ctor(String[] args) in C:\Users\Kari\source\repos\FijiTest\FijiTest\Form1.cs:line 9
   at FijiTest.Program.Main(String[] args) in C:\Users\Kari\source\repos\FijiTest\FijiTest\Program.cs:line 14

ImageJTest.zip

I've attached a project which replicates the error.
Best, Erik

@GeorgeS2019
Copy link

@BiologyTools
Copy link
Author

BiologyTools commented Jun 22, 2024

@GeorgeS2019 Following your instructions using the develop branch I got ImageJ to run. However the buttons don't show up and instead show Chinese letters. Which is just a language issue so everything works thanks!
image

@GeorgeS2019
Copy link

This is something yet to be addressed. It seems to only happen in Windows and not linux. You may need to check that.

@xela-trawets
Copy link

Looks like that might be a Unicode issue (32 bits Linux vs 16 bits on windows), errors on size or alignment in unicode often fall into chinese characters (there are so many more than Latin alphabets)

(I apologize for the drive by comment)

@GeorgeS2019
Copy link

How to solve

@BiologyTools
Copy link
Author

@xela-trawets @GeorgeS2019 The encoding issue has already been solved at least on my Windows 11 machine ImageJ starts up normally.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants