This content has been marked as final. Show 15 replies
I'm taking wild guesses here, but I experienced a similar problem a few days ago. You're not using NetBeans by any chance are you?
Make Sure that your .class file is in your library
you may check by navigating folders jdk1.X--->lib--->
or else you have to set class path
set class path in your cmd prompt
c:/> set classpath=%classpath%; c:/jdk1.6/lib; for windows
simillarly you may try with shell programming in unix
then compile your class and then execute....
this will work
Edited by: rajesh_beu on Mar 19, 2008 5:18 AM
Thanks for your reply!!
I am running the jar file in unix environment only. Please let me know which .class file you are referring to. The exception says that the awt related class file is not found. So, do i have to set this in the classpath?
Many thanks in advance!!!
My bet is that you don't have an X-Server running. It has nothing to do with the class path, the error message clearly says that the class failed to initialize.
have you logged onto that machine from a terminal?
Yes, I tried to connect through SSH to the machine.
But how do I start the XServer?
thats the "problem"
The host's X server is not accessible from a client thats logged in via a terminal. You cant make it start for you. You need to be on the real server to run gui programs. Alternatively, convert your programs to run in command prompt mode only
The host's X server is not accessible from a client thats logged in via a terminal.Usually no X server runs on a "server" host. The X server runs on the "client", it is server in the sense of the GUI environment.
In order to handle the screen(s), the keyboard, the pointing device it should run on the box where they are connected to.
Usually you start the X server on your box, login to the the remote host, set the DISPLAY variable to point to your box, enable the host to connect to your X server, and then run the GUI-aware programs on the remote host.
Thanks for your reply!
Please correct me if my understanding is wrong.
I have a remote machine in which the java application is present. I connect to this remote machine through SSH secure client from my laptop and run java -jar <jar file name>.
From your response, I find that X server should run on the client. So, in this case, the client is the laptop in which the terminal is running?
Also, please let me know how to enable the remote host to connect to the X server.
Thanks in advance!
So, in this case, the client is the laptop in which the terminal is running?If you want to remotely use the screen, the keyboard and the pointing device (aka mouse) of the laptop, then yes.
You'll need an X-Server for the OS of your laptop. What is it? Linux comes with the XFree server, and there are several X-Servers for Windows too, including the free Cygnus one (Red Hat).
You'll need to enable the remote host to connect to your X Server, that is, that the X Server accepts connection requests from that host.
You open an ssh session, that is, log into the remote host, set the DISPLAY variable to point to you laptop's X Server, and start a network-aware program.
You'll need of course a network connection from the remote host to the X Server: that is, your laptop. It can depend on the firewall/router settings. The SSH client can be used to tunnel the X-related network traffic.
There must be tons of X primers on the net.
I remember something about a system property called java.awt.headless. Ah, here's something google turns up:
Basically, you don't want the server to be thinking about monitors, keyboards and mice. And this property set to false tells it so.
I am running a swing jar applicationThe headless option is used when wanting to avoid the usage of the GUI like when a servlet makes some image manipulations.
But it will be difficult with a swing application to avoid the usage of GUI.
You can use X tunneling which is using the -X argument in the ssh command
putty supports tunneling too.