magnetar
magnetar

Reputation: 6577

Is there a general template for turning an applet into a shell program?

Sorry if I haven't asked this in a way people can understand. I have source code for someone's Java applet, and I want to be able to run it from the shell in scripts. The person said I should be able to strip it down and call it from the shell. But what does this require? Does it require using a certain library (for cflags, etc?)? Just a rough answer will do, thanks.

Upvotes: 1

Views: 81

Answers (3)

Paŭlo Ebermann
Paŭlo Ebermann

Reputation: 74810

In principle you can invoke your applet in the appletviewer (this is a program contained in your JRE), which is callable from a shellscript, too. It does not return usable values to your script, though.

The general way would be to add a main method to your Applet, which creates a Frame (or JFrame) and puts the applet inside it. Hope the applet doesn't call much applet-specific methods, since they won't work (if you don't implement and supply an own AppletStub).

Upvotes: 1

bmargulies
bmargulies

Reputation: 100153

Here is the official answer: http://java.sun.com/developer/technicalArticles/Programming/TurningAnApplet/.

Upvotes: 1

Related Questions