Reputation: 3042
My run script start.bat
java -server -Xmx1024m -Xbootclasspath/p:"/Java/Server Applet/bin" applet.Server
When I execute it from SSH terminal ./start.bat
I get this:
Exception in thread "main" java.lang.NoClassDefFoundError: applet/Server
Caused by: java.lang.ClassNotFoundException: applet.Server
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
. Program will exit.in class: applet.Server
Yet when I login using vncviewer, and run the script it runs fine. What could be wrong?
Upvotes: 0
Views: 825
Reputation: 13819
There error seems to indicate a class path error, Java can't find this file:
/Java/Server Applet/bin/applet/Server.class
And like Chochos writes, you can't use any graphical (awt, swing, applet) stuff in this program if you are connect by SSH. Although that is not what this error seems to complain about.
You can use some graphic functions in SSH mode if you run Java in headless mode by adding the following command line parameter:
-Djava.awt.headless=true
But this does not give full graphical access:
Sun Developer network: Using Headless Mode in the Java SE Platform:
Many methods in the java.awt.Toolkit and java.awt.GraphicsEnvironment classes, with the exception of fonts, imaging, and printing, require the availability of a display device, keyboard, and mouse. But some classes, such as Canvas or Panel, can be executed in headless mode. Headless mode support has been available since the J2SE 1.4 platform
Upvotes: 2
Reputation: 5159
You need to use ssh -X to let the remote session use your X server. With VNC you use the local graphic environment (of the remote server) so no problem, but with ssh you are running a remote program in a session with no GUI.
Upvotes: 1