开发者

Error compiling Java file with special characters in class name

开发者 https://www.devze.com 2023-03-05 12:30 出处:网络
I am encountering an issue compiling a source file with a special character in the class name.The class file compiles fine in the Eclipse IDE, but not from javac.I believe I need to leverage the -enco

I am encountering an issue compiling a source file with a special character in the class name. The class file compiles fine in the Eclipse IDE, but not from javac. I believe I need to leverage the -encoding flag, but haven't hit the right setting yet. I would appreciate any pointers:

File Name: DeptView和SDO.java

Java Source:

public interface DeptView\u548cSDO {

   public int getDeptno();

   public void setDeptno(int开发者_开发知识库 value);

}

Error Message:

Running javac *.java results in the following error message:

javac: file not found: DeptView?SDO.java

UPDATE

  • I am currently trying the compile at a Windows XP command prompt
  • Ultimately this compile will need to be part of an ant build, an run on different operating systems
  • I work on the tool that is producing this generated source file.


One solution is to list the file name of each compilation unit in a separate file, say files, and pass @files as a command-line argument to javac. Otherwise, you will have to set the locale of your shell, so that it is using the correct character encoding.


Have you tried using -encoding UTF8 or -encoding UTF16LE (Little Endian) or -encoding UTF16BE (big endian)? (The usage of LE or BE depends on the system you are using -- Windows is LE from what I remember.)

0

精彩评论

暂无评论...
验证码 换一张
取 消