2

无法在 NetBeans 中编译您的项目,这是错误:

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 4.094s
Finished at: Sat Nov 17 00:23:08 MSK 2012
Final Memory: 8M/247M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project AdminCmd: Compilation failure
C:\Users\Максим\Documents\NetBeansProjects\AdminCmd\src\main\java\be\Balor\Tools\Help\String\ACMinecraftFontWidthCalculator.java:[30,33] error: unmappable character for encoding Cp1251
-> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

这是 maven 发誓的文件

http://pastebin.com/buQEE4Fb

项目到 Git - https://github.com/Belphemur/AdminCmd

如果有人可以提供 NetBeans 或 Eclipse 的工作草案!

4

3 回答 3

2

This is interesting, as your pom.xml mentions

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

.. but the error message complains about Cp1251 encoding. Does the maven output mention anything else related to source encodings?

My recommendation is generally to not use any high-ASCII characters in your code, and use the \uxxxx notation instead as needed.

You can make the conversion from UTF-8 to escaped unicode at online conversion sites like http://www.endmemo.com/convert/EMUnicode.php (this particular one seems to strip leading zeroes, I don't think that's legal in Java)

于 2012-11-16T20:39:41.143 回答
1

You have characters in that file which are likely not mapped in the Windows codepage (which is the reference to Cp1251). Try changing the project encoding to UTF-8 or similar. Look into different encoding schemes.

于 2012-11-16T20:39:14.903 回答
0

就我而言,我通过设置新的环境变量解决了这个问题:

JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

在执行 maven 的命令行中,在执行 maven 命令之前运行当前命令:

SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

于 2020-08-18T17:52:52.510 回答