Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
Netbeans Chinese characters in java project properties run arguments

I am writing a Netbeans java program to handle Chinese characters in arguments. I am able to use unicode codes and Chinese characters in my coding and they compiles and display on console correctly. However, when I pass the Chinese characters via project properties run arguments, they all turn into ?????. I have already set my project encoding to UTF-8 and VM options -Dfile.encoding=UTF-8. Here is my coding, please help.

public static void main(String[] args) {
    String test = "\u5973\u58eb";
    System.out.println(test);      //works
    String test2 = "女士2";
    System.out.println(test2);     //works
    System.out.println(args[0]);   //copy&paste test2 to argument, not works, showing ??
}

NB: I use jdk 1.8.0_202, Ant v1.10.4, Windows 10, Netbeans 10, fonts used for Netbeans output and termianl are monospaced14, project is created using Netbeans "java application". Problem occurs when run within Netbeans or on Windows command prompt chcp 65001 both with -Dfile.encoding=UTF-8.

NB: With skomisa's advise, I further test with Windows "use unicode utf8 for worldwide language support" checked. I also move away from Netbeans but use the jar to run on Windows cmd with chcp 65001.

D:\.......>java -cp dist/myjar.jar -Dfile.encoding=UTF8 java.mypackage.TestUTF8 女士
女士
女士2
女士

D:\.......>java -cp dist/myjar.jar java.mypackage.TestUTF8 女士
??
??2
女士

So with -Dfile.encoding=UTF8 (first run), constant string in coding works while arguments not. Without -Dfile.encoding (second run), in-code constants not work while arguments works. But I need both. I have Chinese constant string in my program as well as in program arguments. Can somebody tell me what can be done please.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda