Start New Discussion within our Software Development Community

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" );

try
{
    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?

This question has already been answered. Start a new discussion instead.