views:

147

answers:

3
+1  Q: 

Supressing GUI?

I am trying to run a plugin designed for Vuze using Java. For this I am using a command like this:

/home/x/jre1.6.0_14/bin/java -Dazureus.config.path=/home/x/plugin_directory -Dfile.encoding=ANSI_X3.4-1968 -classpath /home/x/P/lib/swtgraphics2d.jar:/home/x/P/lib/Azureus2.jar:/home/x/P/lib/swt.jar org.gudy.azureus2.ui.swt.Main

The problem with this is that the launch is failing with an error:

changeLocale: *Default Language* != English (United States). Searching without country..
changeLocale: Searching for language English in *any* country..
changeLocale: no message properties for Locale 'English (United States)' (en_US), using 'English (default)'
Invoking main failed
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.aelitis.azureus.launcher.MainExecutor$1.run(MainExecutor.java:37)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
    at org.eclipse.swt.SWT.error(SWT.java:3910)
    at org.eclipse.swt.widgets.Display.createDisplay(Display.java:863)
    at org.eclipse.swt.widgets.Display.create(Display.java:851)
    at org.eclipse.swt.graphics.Device.<init>(Device.java:152)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:479)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:470)
    at org.gudy.azureus2.ui.swt.mainwindow.SWTThread.<init>(SWTThread.java:84)
    at org.gudy.azureus2.ui.swt.mainwindow.SWTThread.createInstance(SWTThread.java:59)
    at org.gudy.azureus2.ui.swt.mainwindow.Initializer.<init>(Initializer.java:110)
    at org.gudy.azureus2.ui.swt.Main.<init>(Main.java:88)
    at org.gudy.azureus2.ui.swt.Main.main(Main.java:255)
    ... 6 more
Exception in thread "MainRunner" java.lang.SecurityException: VM exit operation prohibited
    at org.gudy.azureus2.core3.security.impl.SESecurityManagerImpl$2.checkExit(SESecurityManagerImpl.java:274)
    at java.lang.Runtime.exit(Unknown Source)
    at java.lang.System.exit(Unknown Source)
    at com.aelitis.azureus.launcher.MainExecutor$1.run(MainExecutor.java:42)
    at java.lang.Thread.run(Unknown Source)

I am sure that this is happening because I am running the program on a terminal. Is there a way to supress the GUI or let the program think that the GUI was spawned successfully? Any suggestions?

+1  A: 

You can start a virtual display via vnc and let java use this. (See for example: http://stevenharman.net/blog/archive/2008/12/13/vnc-to-a-headless-ubuntu-box.aspx)

There are also headless parameters for certain libraries, so they run without a display like:

-Djava.awt.headless=true

(This needs to be appended to the java command line call or somewhere in the config, depending on the framework you are using)

Patrick Cornelissen
Oh.. I'm not using vnc but rather a barebones terminal from Ubuntu. Do you mind being a little more specific? I'm afraid I did not get your answer but thanks for your time though.
Legend
+1  A: 

Try setting the DISPLAY environment variable in your terminal before running:

export DISPLAY=<IP address>:0.0

Where is the address of your host (or its hostname).

If you aren't running under a GUI at all, you'll have to run a virtual frame buffer. Xvfb is the one I've used in the past. Just make sure it's installed: sudo apt-get xvfb Then execute the following commands before running your app:

Xvfb :1 -ac -screen 0 1024x768x8 &

export DISPLAY=:1 

Then run the app..

Rob Heiser
I just realize I may have misinterpreted your comment that you were using a "barebones terminal from Ubuntu". Are you not using a GUI at all?
Rob Heiser
Thanks... Yes. I am not using a GUI at all. This is a remote ssh. In addition, when I use the Xvfb command, it keeps giving me "error opening security policy file /usr/lib/xserver/SecurityPolicy" and never allows azureus to start.
Legend
Rob Heiser
+1  A: 

Vuze can be run headless, using the Console UI

Hasturkun
For some reason, when I try to do this, one of the plugins that I want working is not working anymore... I am not sure why that could be happening...
Legend