Mastodon

Editing JNLP files – gotcha!

I have been playing with some JavaFX stuff for a little while now and finally gotten to the point where I am trying to deploy my first program. I was a little naive inn thinking this was going to be an easy process and have been forced to have a good hard look at jnlp files. It turns out that most of your apps deployment options are controlled by editing the XML in that file. After a little reading about the different fields I set to tweaking them to see if I could get the effect I was looking for. After making my changes I crossed my fingers and relaunched my app.

No change.

Check my syntax,

No change.

Try some variations.

No change.

No change.

No change.

Try to effect any change whatsoever by editing fields I know are working like <vendor>Mike Williamson</vendor>.

No change.

A little poking around reveals that Java is thoughtfully caching the jnlp file and has been totally ignoring all my changes since the first time I loaded the app. Thanks Java. I’ll appreciate that someday.

Under windows go to Control Panel > Programs and open the java control panel. Under Temporary Files settings click “delete files” as shown below and suddenly everything works. Yay!

clearing-java-cache

Missing images in JavaFX on Ubuntu Karmic

Last weekend was spent installing Ubuntu Karmic on my laptop. Because of all the programming stuff I am working on it just made sense even though I am already missing a few of my favourite Windows programs. As soon as I got Netbeans set up I tried running a JavaFX application I had been working on. The stage icons and the images I had loaded in were nowhere to be seen. I gave this a few days to percolate and sat down this evening to sort it out. I started out thinking that it might be a problem with the file paths being different on *nix but a little experimentation showed that paths were not the problem. It took a little reading before I got a reminder; Sun is not the default JVM on Ubuntu! Grrrr.

After switching to Sun Java away from Open-JDK all my images and stage icons were loading happily and my JavaFX app runs just like it did on Windows. Here is the command:

mike@sleepycat:~$ sudo update-alternatives –config java
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection    Path                                      Priority   Status
————————————————————
* 0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/java to provide /usr/bin/java (java) in manual mode.