错误编译类名称中带有特殊字符的Java文件 [英] Error compiling Java file with special characters in class name

查看:75
本文介绍了错误编译类名称中带有特殊字符的Java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编译类名中带有特殊字符的源文件时遇到问题.该类文件可以在Eclipse IDE中正常编译,但不能从javac中编译.我相信我需要利用-encoding标志,但尚未达到正确的设置.任何指针,我将不胜感激:

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:

文件名: DeptView和SDO.java

File Name: DeptView和SDO.java

Java源:

public interface DeptView\u548cSDO {

   public int getDeptno();

   public void setDeptno(int value);

}

错误消息:

运行javac *.java会导致以下错误消息:

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

javac: file not found: DeptView?SDO.java

更新

  • 我目前正在Windows XP命令提示符下尝试编译
  • 最终,此编译将需要成为ant构建的一部分,并且可以在不同的操作系统上运行
  • 我正在使用用于生成此生成的源文件的工具.

推荐答案

一种解决方案是在单独的文件(例如files)中列出每个编译单元的文件名,并将@files作为命令行参数传递到javac.否则,您将必须设置外壳的语言环境,以便它使用正确的字符编码.

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.

这篇关于错误编译类名称中带有特殊字符的Java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆