Installing a web server for a Java Webstart Deployment

The goal is to install a HTTP server on a linux box (debian) and place the files from a Java project in there to allow a deployment via Java Webstart. This is a reminder for myself, nothing that can’t be found by googling a little.

Install a HTTP server

I used apache as a server (it just works, there might be better options):

apt-get update
apt-get install apache2 apache2-doc apache2-utils

Check that the procedure worked by trying to access the server at http://hostnameOrIp, which should show a default web page.

That default page is located in /var/www, so you can start placing files in there as you wish.

Optional: make the folder available to Windows computers on the network via Samba:

Add the following profile to /etc/samba/smb.conf

[www]
   comment = Web Server
   path = /var/www
   guest ok = yes
   browseable = yes
   writeable = yes
   create mask = 0777
   directory mask = 0777

Change the permissions:

sudo chmod 777 -R /var/www

And restart Samba:

/etc/init.d/samba restart

Prepare the Java project files

I assume that the project is packaged as a JAR file, with a certain number of dependencies, available as JAR files too.

You can then sign and deploy the files to the server, with the associated JNLP file.

Prepare the index.html

A very basic html page containing a "launch" button:

<html><body>
    <script src= "http://www.java.com/js/deployJava.js"></script>
    <script>
        // using JavaScript to get location of JNLP
        // file relative to HTML page
        var dir = location.href.substring(0, location.href.lastIndexOf('/')+1);
        var url = dir + "YourJnlp.jnlp";
        deployJava.createWebStartLaunchButton(url);
    </script>
</body></html>
Advertisements
Tagged , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: