Tutorial 1: Embed WWJava Into a Web Page

Written by Chad on August 6th, 2008

Going to be doing several WWJava use posts in the next few weeks.  Will start off with the basics, I am NOT going to be going into the Java code (as I am not a Java dev so it would be pointless right now then).  So this will just be a basic WWJava globe we will be working with in with this example and the others to follow.

Embedding WWJava into you’re website is a simple process that requires two files, a web page and the applet embed code.  First you need the two local WWJava files to make the applet work, you can download them here: wwj_appletfiles. These files need to be in the same folder as the applet web page.

Next we need to edit the web page file, in my case index.html and add the applet embed code to the file.  The applet embed code is as follows:

<applet id="wwjApplet" name="wwjApplet" mayscript code="org.jdesktop.applet.util.JNLPAppletLauncher" width=600 height=380 archive="applet-launcher.jar, http://worldwind.arc.nasa.gov/java/demos/worldwind.jar, WWJApplet.jar, http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar, http://download.java.net/media/gluegen/webstart/gluegen-rt.jar">
<param name="codebase_lookup" value="false" />
<param name="subapplet.classname" value="gov.nasa.worldwind.examples.applet.WWJApplet" />
<param name="subapplet.displayname" value="WWJ Applet" />
<param name="noddraw.check" value="true" />
<param name="progressbar" value="true" />
<param name="jnlpNumExtensions" value="1" />
<param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp" />
</applet>

The finished web page will look like this:

<html>
<head>
<title>NASA World Wind Java Applet</title>
</head><body>

<applet id="wwjApplet" name="wwjApplet" mayscript code="org.jdesktop.applet.util.JNLPAppletLauncher" width=600 height=380 archive="applet-launcher.jar, http://worldwind.arc.nasa.gov/java/demos/worldwind.jar, WWJApplet.jar, http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar, http://download.java.net/media/gluegen/webstart/gluegen-rt.jar">
<param name="codebase_lookup" value="false" />
<param name="subapplet.classname" value="gov.nasa.worldwind.examples.applet.WWJApplet" />
<param name="subapplet.displayname" value="WWJ Applet" />
<param name="noddraw.check" value="true" />
<param name="progressbar" value="true" />
<param name="jnlpNumExtensions" value="1" />
<param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp" />
</applet>

</body>
</html>

That is all that is needed to have a WWJava globe in your web page.  Save the file and open it in your favorite web browser.

The embedded applet looks like this then once it is loaded:

I will expand on this tutorial in other posts.

Share/Save/Bookmark

0 Comments so far ↓