Macworld Forums: Java Issues... (Java Guru Needed) - Macworld Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Java Issues... (Java Guru Needed)

#1 User is online   Demonic_Rush Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 98
  • Joined: 27-August 07

Posted 09 April 2008 - 01:50 PM

Okay, so I'm using Jbuilder and would like to display Japanese Characters in the console The following is the only way I could manage to get it to display albeit it only displays in a popup:
-----------------
--------------------------------------
import java.util.*;
import java.io.*;
import javax.swing.*;

public class japanesetestclass {
public static void main(String[] args)
throws IOException, FileNotFoundException {
PrintWriter output = new PrintWriter("temp.txt", "Cp933");
System.out.println("ひらがな の けんさ です。u3041");
String test = "ひらがな の けんさ u3041";
System.out.println(test);
output.println( "u3041 おい! レイ です。 よろしく おねがいします。Hey There! Rey Here. Pleasure to make your acquaintance." );
output.println( "Hey There! Rey Here. Pleasure to make your acquaintance." );
output.close();

Scanner input = new Scanner(new File("temp.txt"), "Cp933");
JOptionPane.showMessageDialog(null, input.nextLine());
}
}
-----------------------------------
----------------
I would like to have the Japanese display using system.out.println("xxxx") and not have it as a pop up.
(This is my first Java Class but I'm hoping to have my final project be a program that aids students in learning Japanese Characters. I'm using OS X 10.5.2)
0

#2 User is offline   Dr-NiKoN Icon

  • Member
  • PipPip
  • Group: Members
  • Posts: 741
  • Joined: 20-May 01

Posted 02 June 2008 - 03:01 PM

You probably just need to figure out how to change the character encoding for the console in JBuilder.
Alternatively, you could try to use Unicode encoding in your program instead of "cpp933".
Or your last option, run the code in Terminal.app, it's pretty easy to change the character encoding there.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users