Today, I was looking into the new jnlp_href way of launching a Java Applet. Just like applet-launcher, this allows one to create applets that depend on native libraries without the usual hassle of manually downloading the files and installing them.
Contrary to applet-launcher, it’s built into the later versions of Java 1.6 and it’s officially supported, so I have higher hopes concerning its robustness.
It’s even possible to keep the applet-launcher calls in there if the user has an older Java Plugin that doesn’t support jnlp_href yet.
So in the end, you just write a .jnlp file describing your applet and add
<param name="jnlp_href" value="http://www.example.com/path/to/your/file.jnlp">
and be done with it.
Unless of course, your JNLP file has a syntax error. Then you’ll get this in your error console (at least in case of this specific syntax error):
java.lang.NullPointerException at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Ausnahme: java.lang.NullPointerException
How helpful is that?
Thanks, by the way, for insisting to display a half-assed German translation on my otherwise english OS: Never use locale info for determining the UI langauge, please.
Of course, this error does not give any indication of what the problem could be.
And even worse: The error in question is the topic of this blog post: It’s the dreaded Alt-Space character, 0xa0, or NBSP in ISO 8859-1.
0xa0 looks like a space, feels like a space, is incredibly easy to type instead of a space, but it’s not a space - not in the least. Depending on your compiler/parser, this will blow up in various ways:
pilif@celes ~ % ls | grep gnegg zsh: command not found: grep pilif@celes ~ % pilif@celes ~ % cat test.php <? echo "gnegg"; ?> pilif@celes ~ % php test.php PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /Users/pilif/test.php on line 2 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /Users/pilif/test.php on line 2 pilif@celes ~ %
and so on.
Now you people in the US with US keyboard layouts might think that I’m just one of those whiners - after all, how stupid must one be to press Alt-Space all the time? Probably stupid enough to deserve stuff like this.
Before you think these nasty thoughts, I ask you to consider the Swiss German keyboard layout though: Nearly all the characters use programmers use are accessed by pressing Alt-[some letter]. At least on the Mac. Windows uses AltGr, or right-alt, but on the mac, any alt will do.
So when you look at the shell line above:
ls | grep gnegg
you’ll see how easy it is to hit alt-space: First I type ls, then space. Then I press and hold alt-7 for the pipe and then, I am supposed to let go of alt and hit space. But because my left hand is on alt and the right one is pressing space, it’s very easy to hit space before letting go of alt.
Now instead of getting immediate feedback, nothing happens. It looks as if the space had been added, when in fact, something else has been added and that something is not recognized as a white space character and thus is something completely different from a space - despite looking exactly the same.
As much fun as reading
hexdump -C output is - I need this to stop.
Dear internet! How can I make my Mac (or Linux when using the Mac keyboard layout) stop recognizing Alt-Space?
To take air out of the eventually arriving troll’s sails:
- I won't use Windows again. Thank you. Neither do I want to use Linux on my desktop.
- I cannot use the US keybindings because my brain just can't handle the keyboard layout changing all the time and as I'm a native German speaker, I do have to type umlauts here and then - actually often enough, so that the ¨+vocal combo isn't acceptable.
- While running Mac OS X, I'm stuck with the mac keyboard layout - I can't use the Windows one.
Above JNLP error (printed here just in case somebody else has the same issue) caused me to lose nearly 5 hours of my life and will force me to work this weekend - who’d expect a XML parser error due to a space that isn’t one when seeing above call stack?
Update: A commenter on reddit.com has recommended to use Ukelele which I did and it helped me to create a custom keyboard layout that makes alt-space work like just space. That’s the best solution for my specific taste, so thanks a lot!
blog comments powered by Disqus