How to see Japanese characters in java, under ms-windows

Some important things right away

0. This page was originally written a loong time ago. I'm now putting notes on newer versions of windows and java at the top. Older stuff is lower down. Sections may be disjointed and not flow logically.. sorry, this whole page probably needs to be rewritten at this point.

1. I have no idea if it even possible under mswindows 3.1

2. mswindows NT 4.0 supposedly already HAS unicode support. (If it doesn't out of the box, someone please let me know)

3. I now have a possibly working proceedure for jdk1.3

Font Check

First things first. Let's check if you already have the right fonts installed.
Pull up netscape, and take a peek at www.mainichi.com, or some other site with japanese text chars. You might want to shift-click to "open in new browser window". You might see some characters okay in the menu. beware; those are GIFs! What you care about is the chars in the main body of the page. If you can't highlight them, they are not actual characters.

No luck? Make sure you are set to display them. You have to now go to the "View" menu, then "Language Encoding", and pick "Japanese (Auto-detect)"

Still didn't work? Okay, let's try option 2. Assuming you are using netscape 4, go to the preferences menu. Then click on the fonts section, under Navigator.

Select Japanese instead of Western language. Then see if "MS Gothic" is a font option.

If it is not, you will need an appropriate font.

If you have a recent version of windows, either you already have the needed fonts, or you can use the "windows update" site to get japanese language support. (Hmm.. but this feature apparently doesnt work for XP) (try searching for "IE language pack")

If you have a non-recent version of windows, you may also need to install the IE "internationalization kit" for Japanese (even if you don't have IE installed, or don't use IE!).

An alternative set of japanese fonts can be obtained from Adobe's website.

You can get the microsoft Japanese patch from one of the kanjidic mirror sites. Filename is "ie31pkja.exe". You should also get the other font, MS Mincho, which is under the file "JapSupp.exe", or "JpnSupp.exe". One is "IE japanese support", the other is "MS Office Far East support"

The key thing really is to get the fonts in each package, not neccessarily the packages themselves. But it doesnt hurt to just install them. JDK1.3 actually makes use of BOTH FONTS, so install both of them.

MS windows XP, java 1.5 or newer

If you have a newer version of windows, you should already have japanese fonts installed. Sadly, java 1.5 and newer, does not automatically USE these fonts; you still will need to tweak properties. Happily, it is a one-line fix.

After copying (jre/lib/)fontconfig.properties.src to fontconfig.properties, edit the file, and change the line

sequence.allfonts=alphabetic/default,dingbats,symbol
to
sequence.allfonts=alphabetic/default,dingbats,symbol,japanese
This seems to do the trick. Note that my unicode.class tester still will NOT work. However, jdrill will.

Older java runtimes and/or windows versions, below

Note for MS-windows 2000

If you want to install the "official language pack", you may instead need/want a file called 'ie_ja.exe'. it can be found on microsoft.com - look for "Japanese language pack for Office XP" or something like that.

However, if all you want is a japanese compatible font, you can get away with just finding a copy of the free "Bitstream Cyberbit" font, extracting it to its .ttf form, and then right-click "install" on modern versions of ms-windows (and/or use the font control panel)


Older (pre-java 6) JRE instructions

We now have to tweak configurations files, unfortunately.

Short cut

If you want to avoid hand-editing files, you can try this shortcut. This assumes you either downloaded the ie3lpkja.exe file mentioned, or you already have the "MS Gothic" font available on your system.

First, into the jre directories, and find where the "font.properties" file is. This files are probably found somewhere like C:/Program files/Javasoft/jre/1.1 You can then copy the "font.properties.ja" file, over to "font.properties", and then things may work for you.

WARNING#1: I have not gotten this to work myself

WARNING#2: This only works for ms-windows, not other OS's. For example, copying over the font.properties.ja file in Solaris most definately does NOT work.

If you're lucky, this copying has enabled you to see Japanese chars. Try running jdrill, and see if you see the appropriate chars at the top. If you do, you're all done!

If this does not let you see japanese chars in jdrill, keep reading!



Bonus step: Install a cleaner font than MS Gothic

If you are on an older version of windows, I personally recommend using a true UNICODE font, described below. But you can technically use the old nasty version of "ms gothic" if you wish.

The following covers advice for ms windows95 and NT. Javasoft has a certain amount of advice on the subject (here), but their documentation sux. Here's some hopefully clearer instructions.

First of all, you have to find either a Unicode, or an SJIS(Shift-JIS) font, and install it on your computer. Warning: they can be huge. To install, you may need up to 40 megabytes of hard disk space to install. Once you clean up, the font itself may take up to 13 megabytes or something.

A free unicode font, in truetype format, "Bitstream Cyberbit" is available, at various locations. Try googling it by name, or or you can search explicitly for the filename, If this doesnt work, try a web search for cbkanji.exe or cbkanji.zip

Another truetype font I have seen referenced, but not tried, is at http://www.unionway.com/uwjmg3.htm This one is much smaller in download size. (3 megs). But BEWARE: this is shift-JIS, not unicode.

Truetype fonts, have the "advantage" that it can scale. On the other hand, it may take a long time to load the font on old (year 2000) computers, the first time you start up jdrill (and possibly your other java progs). So a fixed size font would actually be preferable in some ways. Unfortunately, I don't know of any freely available ones. Please let me know if YOU know of one.

Run the .exe file to extract the files, or unzip, if appropriate

You could read through all the loong readme. Or you could pull up control panel, open up "Fonts", and in the File menu, select "Install new font". It should then copy the .ttf file you just extracted, to the system font directory. After that, you're just about set for the next step:
Getting java to acknowledge it :-/


Modify the Java Font Properties

(for jre 1.4 and older. Newer runtimes should see top of this page)

In the place where you have installed java, which is probably

C:\program files\javasoft\jre\1.1

go and edit the lib\font.properties file. (You'll have to use at minimum "wordpad". SAVE AS TEXT. Notepad wont work until you save it from wordpad first)

Assuming you are using the unicode font I specified in step 1, add the following lines:

#[if dialog.3 is in use, use dialog.4, etc]

#This is the jdk1.1 example
dialog.3=Bitstream Cyberbit
dialoginput.3=Bitstream Cyberbit
serif.3=Bitstream Cyberbit
sansserif.3=Bitstream Cyberbit

Or, if you are using jdk1.2 or later, add these lines

# For jdk1.2 and later
dialog.plain.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialog.italic.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialog.bolditalic.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialoginput.plain.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialoginput.italic.4=Bitstream Cyberbit,DEFAULT_CHARSET
dialoginput.bolditalic.4=Bitstream Cyberbit,DEFAULT_CHARSET


filename.Bitstream_Cyberbit=CYBERBIT.TTF

I highly recommend using the above method! It works!

But it is just the minimum to get jdrill working. If you feel like doing extra work, you could make appropriate lines for serif, sansserif, and monospaced :-)


The rest of this page should only be needed if you have a shift-JIS font instead of a Unicode one

(Note that here is instructions for jre1.4 and earlier.Not newer versions)
If you want to use a specific Shift-JIS font instead of a nice unicode one, you will have to instead add something similar to;

dialog.3=MS Gothic,SHIFTJIS_CHARSET
dialoginput.3=MS Gothic,SHIFTJIS_CHARSET
serif.3=MS Gothic,SHIFTJIS_CHARSET
sansserif.3=MS Gothic,SHIFTJIS_CHARSET

(This should work with the microsoft font. But it looks ugly.)

NOTE: "your_SJIS_fontname" should simply be the name of the font, as seen by ms-windows programs: NOT the filename.

At this point, hopefully, you're done! You should now be able to properly see Japanese characters under javasoft's java.

Step 3

If this still fails for you, (in particular, with UnsupportedCharset or something similar), perhaps you have the "english-only" version of the java runtime. If you're using some ancient version of java, such as 1.1, go grab the international version.

It USED to be at http://www.javasoft.com/products/jdk/1.1/jre/ but of course that link is no longer valid :(