Hi everyone,

I have a program that displays Chinese and Japanese characters. I've written the program inside Netbeans and it works fine. But when I use the program as an executable jar file, as built in the dist folder by Netbeans, the Chinese and Japanese characters are displayed as nonsense.

In the IDE the font is set to Meiryo as follows, which I think should be fine ...

candidateComboBox.setFont(new java.awt.Font("Meiryo", 0, 36));

... and I've tried replacing this with a physical truetype font such as ...

File file = new File( "osaka.unicode.ttf" );

    Font font = Font.createFont( Font.TRUETYPE_FONT, file );  		
    font = font.deriveFont( Font.PLAIN, 14f );
    outputField.setFont( font );
catch( Exception error )
    // exception handled here

... but this doesn't work either.

Also, the Japanese/Chinese text that is I want to display in the program GUI is read in from a file saved in UTF-8, and the project encoding setting in Netbeans is UTF-8.

Does anyone have any ideas why something like this would fail to work outside of Netbeans?

maybe osaka.unicode.ttf is not working. or Meiryo is not right for Chinese. I am not sure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.