3829

Java applet as stand-alone Windows application?

I have a Java applet that is meant to run only on Windows. (It uses a 3rd party COM object; it is not cross-platform.)

Is there a way to run a Java applet as a stand-alone application on Windows?

Answer1:

Although you can certainly run it, there are subtle differences between how Java runs as an application vs. how it runs as an applet. One starts with an init method, the other starts with a main method, and the threading and event queue relationship to startup are a bit different.

Here is some documentation from Sun on how to do it. If you are using JApplet things change slightly, but the idea is the same.

Answer2:

Java applets usually don't have a main method. They rely on the webbrowser to be launched.

It is possible though that you create a new class which have a main method and simple call the init() and start() method of the applet.

You may take a look at this to understand better the life cycle of the applets.

Answer3:

I suppose the appletviewer could be an option. It is a utility included in the JDK.

Answer4:

The JDK has an appletviewer applet launcher. It is not available in the JRE and its behaviour may be slightly different from the PlugIn.

Also applets can be run from WebStart if an appropriate JNLP file is provided.

Answer5:

If by "applet" you mean a stand-alone command shell Java program, a simple batch file should suffice:

@rem MyApp.bat @echo off set JVM={{path where java.exe is located}} set FLAGS={{optional JVM flags}} set JARFILE={{location of your jarfile}} %JVM%\java %FLAGS% -cp %JARFILE% {{Package}}.{{Class}} {{args...}}

Replace the items enclosed in braces {{...}} with settings appopriate for your application. If everything is defined correctly, double-clicking the batchfile name in a file explorer window will execute your Java class.

Recommend

  • Getting Applets OutputStream throws an exception: What is wrong?
  • Is there any way to automate the testing of flash within web pages using Watir-Webdriver?
  • Can I execute a local program from a Chrome Plugin?
  • Can I execute a local program from a Chrome Plugin?
  • Get all elements matching an XPath expression in a webbrowser document
  • Proper way of using LocationManager in Codename one
  • Is TWebBrowser dependant on IE version?
  • Gradle Checkstyle Plugin Console Output
  • Secure Box in JCOP card
  • How to debug office add-in for mac?
  • Force iPad app to launch in portrait when landscape is supported
  • WebBrowser: IDropTarget
  • WebSphere MQ 6 message segmentation option ignored in put()?
  • How many percent of the tweets does twitter sample API give?
  • Installing apk from within application in android
  • Validity Method for Reference Classes
  • Injecting service into a mixin Ember2.3+
  • How to reshape a 3D numpy array?
  • JConsole Main class
  • How to select table rows/complete table?
  • JSF2.0 + Primefaces 3.0.1 + jquery 1.6.4 + p:commandLink + IE8 throws Unexpected call to method or p
  • Is there a way to call library thread-local init/cleanup on thread creation/destruction?
  • Classic ASP URL Rewriting
  • Oracle - Second level subquery cannot see field from main query
  • Efficient User-Agent Regex to find Safari in Python
  • rewrite uppercase url to lowercase url htaccess
  • cordova is not defined - cordova.js has already been loaded :: Ionic
  • Jetty 9 HashLoginService
  • Repeat a vertical line on every page in Report Builder / SSRS
  • NetLogo BehaviorSpace - Measure runs using reporters
  • Read text file and split every line in MSBuild
  • C# - Serializing and deserializing static member
  • Finding past revisions of files in StarTeam w/ .NET SDK / C#
  • Jquery - Jquery Wysiwyg return html as a string
  • Comma separated Values
  • SQL merge duplicate rows and join values that are different
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • Reading document lines to the user (python)