Suppressive GUI?
I am trying to run a plugin targeting Vuze using Java. To do this, I use the following command:
/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 is that the startup fails with the 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'm sure this is happening because I am running the program in the terminal. Is there a way to suppress the GUI, or let the program think the GUI was created successfully? Any suggestions?
a source to share
Try setting the DISPLAY environment variable in your terminal before running:
export DISPLAY=<IP address>:0.0
Where is your host address (or its hostname).
If you are not running a GUI at all, you need to run the virtual frame buffer. Xvfb is the one I've used in the past. Just make sure it is installed: sudo apt-get xvfb
Then run the following commands before starting the application:
Xvfb :1 -ac -screen 0 1024x768x8 &
export DISPLAY=:1
Then run the application.
a source to share
You can start virtual display via vnc and let java. (See for example: http://stevenharman.net/blog/archive/2008/12/13/vnc-to-a-headless-ubuntu-box.aspx )
Some libraries also have headless options, so they run without display, for example:
-Djava.awt.headless=true
(This needs to be added to the java command line call or somewhere in the config, depending on the structure used)
a source to share