tags:

views:

72

answers:

4

I want to facilate my client to run java program through UNIX command prompt using some shells. It'll look more effecient if they would be able to give input through some GUI. So it can be tested immedietely. I dont want prefer unix commands fro input.

Can somebody tell me how to run Java swing or applet programs in UNIX?

+1  A: 

Java programs use the X windows system (just like any other GUI on Unix). Assuming your X windows system is setup correctly, you should just open up a JFrame and do your GUI coding just like Windows.

Starkey
suppose my java program exists on remote server. i connect to that server through some remote client, say putty. Now i need to display some applet for input. Would it work?
articlestack
Applets run on the client in a web browser. Assuming that the web browser supports Java, it should work fine.
Starkey
@Starkey "Assuming that the web browser supports Java.." Assuming it does not support Java - look into the deployJava.js. This comment is probably totally messed up. Sorry, am still not quite used to how to use comments on StackOverflow. ;)
Andrew Thompson
A: 

Using the command prompt to launch a GUI is so last millennium. If you can distribute from a server, look into Java Web Start to provide the end-user with a simple and painless install.

Oh, and of course, follow Starkey's advice to throw a JFrame into the mix.

Andrew Thompson
A: 

If you have an X-server installed locally, Putty can tunnel the X11-graphics generated by Linux Java back from the server to your local machine, and view it there.

If the above doesn't make sense to you, your next best bet is either running the Java code locally with Java Web Start (and code it to communicate back to the remote server) or run Servlets inside a Java Web Server running on the remote host.

In other words, GUI over a Putty connection is not something which is easily done.

Thorbjørn Ravn Andersen
+1  A: 

As Thompson mentioned, looking at Java Web Start could be a good idea.

Otherwise, if what you want is to execute, using a *NIX-like terminal, an application located on a remote host and have it rendered on your local display, then you need to do a few things:

  • you need a working X server on the local machine
  • you need to export the DISPLAY to the local machine (you can do this by setting up the DISPLAY environment variable on the remote system)
  • then you need to start your Java app from the command-line.

Hope this helps.

Here's an example of how to export your display over SSH.

haylem