Crawlicious | tools for web business

TAG | jnlp

Jul/09

1

jnlp codebase

I use netbeans to create my jnlp distribution, but there is one sticky part in the deployment process. How do you modify your codebase for your jnlp files? A codebase must set to the webserver’s location where all subsequent files will be located. The way that I manage this is to make a script that recursively modifies all jnlp files to have the same codebase. Here is an example:

#!/bin/bash
if [ "XX${1}" != "XX" ]; then
    address=$1
else
    answer="no"
    while [ $answer != "yes" ]; do
        echo -ne "enter the url for your code (like http://foo.com/my/jnlp): "
        read address
        echo -ne "${address} is your codebase, is this correct? [yes|no]:  "
        read answer
    done
fi

for f in `find . -name "*.jnlp"`; do
    chunk=`echo $f|sed "s#\./##; s#[^/]*.jnlp##"`
    codebase=`echo "${address}/${chunk}" | sed 's#\([^:]\)//#\1/#g'`
    echo "fixing $f, inserting codebase=${codebase}"
    perl -pi -e "s#codebase=[\"\'][^\"\']*[\"\']#codebase=\"${codebase}\"#" $f
done

Another question that you may run in to is, how to I set up jnlp to have a local path so that I can start it with javaws? Simply run the above script with the following path (assuming that you are in the same directory as the distribution).

fixcodebase.sh file:////`pwd`

Now the files will all be pointed to the current directory and the application can find its guts.

Happy jnlping!

, Hide

Find it!

Theme Design by devolux.org