文件地址编码问题-Encoding Changed

本文通过一个实际案例探讨了在文件操作过程中遇到的编码问题。当从一个文件中拷贝内容到另一个文件时,若源文件与目标文件的编码类型不一致,则可能导致文件保存失败或出现乱码。文章建议在进行拷贝操作前,最好先将所有内容统一到相同的编码格式,避免因编码问题引发的错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在一次简单的文件操作中,我遇到了一个十分棘手的问题
这里写图片描述
build的时候就会弹出Encodinng Changed错误并且无法正常运行
经检查,问题出在了路径部分:
输入路径的时候图方便直接于其绝对路径下拷贝
这里写图片描述
导致出现了该问题
将整个代码拷贝入记事本保存时即会弹出文本中存在不同类型的编码,需统一编码才能保存
所以以后还是不要图方便乱拷贝未知编码类型的文本啊~~~
如果要拷贝的话最后也整体放入记事本统一编码,去掉奇奇怪怪的字符后再运行呀!

[INFO] [INFO] --- resources:3.3.1:resources (default-resources) @ JNDI --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory G:\JNDI-master\src\main\resources [INFO] [INFO] --- compiler:3.13.0:compile (default-compile) @ JNDI --- [INFO] Recompiling the module because of changed dependency. [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! [INFO] Compiling 24 source files with javac [debug target 1.8] to target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 21.271 s [INFO] Finished at: 2025-03-22T11:13:09+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project JNDI: Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
最新发布
03-23
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值