Gargan's Java Tipps&Tricks

  1. Gargan's Java Tipps&Tricks
    1. Problems and updates
      1. Java and Linux and öäüß
    2. Java Snippets
      1. Execute a real program from java

Problems and updates

Java and Linux and öäüß

Since I am native Austrian (did you guess?) I spend quite a large amount of time trying to figure out why programs just dont want to show a ä as an ä or an ü as an ü - The weird Umlaute and special Characters you use in written Language in almost all Countries except English-based ones (English really seems to have the absolute smalles amount of characters in the whole world). You guys normally live in a world of iso8859-1, which is fine for you, but me and most other people have to go around with things like iso8859-15 with Euro support (€) and many more characters. In Windows it is not that big of a problem, in Linux neither, BUT when it comes to using Sun's JDK+Linux you can easily get into trouble (same goes for mysql).

Solution for java:
The solution I found when seeing the box instead of the char in Java progs was to edit the font.properties found in your jre/lib dir and replace the Character Encodings from  sun.io.CharToByteISO8859_1 to sun.io.CharToByteISO8859_15 and now look at this! IT WORKED (at least for me)!

# Component Font Character Encodings
#
fontcharset.serif.0=sun.io.CharToByteISO8859_15
fontcharset.serif.1=sun.awt.CharToByteSymbol

fontcharset.sansserif.0=sun.io.CharToByteISO8859_15
fontcharset.sansserif.1=sun.awt.CharToByteSymbol

fontcharset.monospaced.0=sun.io.CharToByteISO8859_15
fontcharset.monospaced.1=sun.awt.CharToByteSymbol

fontcharset.dialog.0=sun.io.CharToByteISO8859_15
fontcharset.dialog.1=sun.awt.CharToByteSymbol

fontcharset.dialoginput.0=sun.io.CharToByteISO8859_15
fontcharset.dialoginput.1=sun.awt.CharToByteSymbol

Java Snippets

Execute a real program from java

Process p = Runtime.getRuntime().exec("command.com");               
// in case you want to wait until it has finished
p.waitFor();