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

Show help text when ran in headless environment without args #76

Open
wants to merge 1 commit into
base: 2.0
Choose a base branch
from

Conversation

PaintNinja
Copy link
Contributor

Currently the installer crashes if you run it without args in a headless environment. This PR makes it show the help text instead, which is more user-friendly. Also fixed a typo.

@LexManos
Copy link
Member

Last time we tried this it didn't throw the headless exception and there wasn't a good non wrrorong way to detect it was headless. But if this works go for it.

@PaintNinja
Copy link
Contributor Author

PaintNinja commented May 31, 2024

I found out about the headless exception from a log a user provided in the Discord:

JVM info: Oracle Corporation - 22.0.1 - 22.0.1+8-16
java.net.preferIPv4Stack=true
Current Time: 30/05/2024 22:18:59
Host: files.minecraftforge.net [104.21.58.163, 172.67.161.211]
Host: maven.minecraftforge.net [172.67.161.211, 104.21.58.163]
Host: libraries.minecraft.net [13.107.246.42]
Host: launchermeta.mojang.com [13.107.246.42]
Host: piston-meta.mojang.com [13.107.246.42]
Host: sessionserver.mojang.com [13.107.246.42]
Host: authserver.mojang.com [Unknown]
Data kindly mirrored by CreeperHost at https://www.creeperhost.net/
java.awt.HeadlessException:
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,
        at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
        at java.desktop/java.awt.Window.init(Window.java:501)
        at java.desktop/java.awt.Window.<init>(Window.java:453)
        at java.desktop/java.awt.Window.<init>(Window.java:608)
        at java.desktop/java.awt.Dialog.<init>(Dialog.java:674)
        at java.desktop/java.awt.Dialog.<init>(Dialog.java:519)
        at java.desktop/javax.swing.JDialog.<init>(JDialog.java:426)
        at java.desktop/javax.swing.JOptionPane.createDialog(JOptionPane.java:957)
        at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:258)
        at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:182)
        at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:154)
Exception in thread "main"
java.awt.HeadlessException:
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,
        at java.desktop/java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:166)
        at java.desktop/java.awt.Window.<init>(Window.java:553)
        at java.desktop/java.awt.Frame.<init>(Frame.java:428)
        at java.desktop/java.awt.Frame.<init>(Frame.java:393)
        at java.desktop/javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1925)
        at java.desktop/javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:2001)
        at java.desktop/javax.swing.JOptionPane.getRootFrame(JOptionPane.java:1696)
        at java.desktop/javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:875)
        at java.desktop/javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:677)
        at java.desktop/javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:648)
        at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:185)
        at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:154)

So maybe they fixed it not throwing or it only throws sometimes? Dunno ¯\_ (ツ)_/¯

@LexManos
Copy link
Member

LexManos commented Jun 1, 2024

Maybe, java does a lot of changes. As long as this doesn't bump the required java (it shouldn't iirc that exception is from java 1.4) then I'm fine with it.

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

Successfully merging this pull request may close these issues.

2 participants