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

Can't run CLI without window manager #46

Open
prat0088 opened this issue Nov 27, 2013 · 3 comments
Open

Can't run CLI without window manager #46

prat0088 opened this issue Nov 27, 2013 · 3 comments
Assignees
Milestone

Comments

@prat0088
Copy link

When I try to run BDSup2Sub over SSH without X11 tunneling I get an error:

java -jar ../Software/BDSup2Sub_v5.1.1.jar --help
Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.awt.X11GraphicsEnvironment.initDisplay(Z)V
        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
        at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:110)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:190)
        at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:119)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:190)
        at java.awt.Toolkit$2.run(Toolkit.java:868)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:860)
        at javax.swing.UIManager.getSystemLookAndFeelClassName(UIManager.java:608)
        at javax.swing.UIManager$1.run(UIManager.java:1230)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.swing.UIManager.loadSwingProperties(UIManager.java:1225)
        at javax.swing.UIManager.initialize(UIManager.java:1453)
        at javax.swing.UIManager.maybeInitialize(UIManager.java:1422)
        at javax.swing.UIManager.getDefaults(UIManager.java:656)
        at javax.swing.UIManager.getColor(UIManager.java:698)
        at bdsup2sub.core.Configuration.<clinit>(Configuration.java:32)
        at bdsup2sub.BDSup2Sub.<clinit>(BDSup2Sub.java:35)

The problem is that BDSup2Sub/src/main/java/bdsup2sub/core/Configuration.java initializes "public static final Color OK_BACKGROUND = UIManager.getColor("TextField.background");" in the class and not the constructor.

One way to fix this would be to add a isCLI as a required parameter to the constructor, and OK_BACKGROUND would only be initialized if isCLI is false.

@mjuhasz
Copy link
Owner

mjuhasz commented Nov 27, 2013

It was never my intention to make this desktop application work in a headless environment but I am willing to look into how much work it would be and time permitting implement it.

Indeed we should not eagerly initialize the GUI related parts if we don't need the GUI at all. Whether we need the GUI or not is not a trivial question. Just because the application is started from command line it does not mean the GUI is not loaded later. One example is when you start the application without the output file name specified:

java -jar BDSup2Sub [options]

This will result in loading the GUI with the specified input file pre-loaded for you and all the options applied.

I will look into what needs to be done to make BDSup2Sub work in a headless environment. Essentially if we don't have a full command line (e.g. no output file name specified) the fallback should be starting the GUI if we have a display (this is the current behavior) and a descriptive error message in a headless environment (this needs some work). If we have a full command line it should work regardless of the presence of a display (this needs some work as well).

@ghost ghost assigned mjuhasz Nov 27, 2013
@prat0088
Copy link
Author

I see. That makes sense. I'm grateful that BDSup2Sub even has a CLI mode in the first place and can convert my PGS subs. : ) As far as the scenarios you describe, I'm happy to have a basic headless sub conversion work from

@mjuhasz mjuhasz reopened this Nov 27, 2013
@mjuhasz
Copy link
Owner

mjuhasz commented Nov 27, 2013

I am happy to hear you like the CLI mode ;-)
BTW, I reopened this issue because this way it's listed for the next milestone so it remains on my radar. You'll be notified when it has been fixed and I'll close the issue then.

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

2 participants