简体   繁体   English

符号 λ 在 jar 文件中不起作用,但在 eclipse 中运行是

[英]symbol λ doesn´t work in jar file but in eclipse run yes

I do not have any problem while I am in Eclipse, but when I run a the jar file, problems apperars.我在 Eclipse 中没有任何问题,但是当我运行 jar 文件时,出现问题。

This are the different exists that produce the program.这是产生程序的不同存在。 Eclipse

   Clave: B := CB| b| S| 
   Clave: S := aBCd|  -> axioma
   Clave: C := cc| e| λ|  

Jar Exit from Jar file I can´t write because have special characters Jar从 Jar 文件退出我不能写,因为有特殊字符

The problem is that the jar file doesn´t write λ in the variable of the program, so when i want to use the program crash.问题是jar文件没有在程序的变量中写入λ,所以当我想使用程序时崩溃。

This is in a Spring Application.这是在 Spring 应用程序中。

Thanks谢谢

This is an encoding problem : eg λ encoded in UTF-8 will be shown as λ when using the ISO-8859-16 encoding.这是一个问题编码:例如λ在编码UTF-8将被示出为λ使用ISO-8859-16编码时。

Because strings are stored as UTF-8 in Java bytecode, the encoding error could occur either during compilation or when printing:由于字符串在 Java 字节码中以 UTF-8 格式存储,因此在编译或打印时可能会发生编码错误:

  • If you are not using Eclipse to create the JAR but eg Maven or Gradle, make sure to use the correct encoding for the source code in the compile task (see here for Maven and here for Gradle )如果您不是使用 Eclipse 来创建 JAR,而是使用 Maven 或 Gradle,请确保在编译任务中使用正确的源代码编码(参见此处的 Maven此处的 Gradle
  • When output ting, make sure that where UFT-8 is printed, this is correctly decoded as UTF-8 .输出ting 时,请确保打印UFT-8 的位置正确解码为 UTF-8 This depends on where λ is printed (eg on the Windows command prompt, on a Linux terminal or into an HTML file).这取决于λ的打印位置(例如,在 Windows 命令提示符上、在 Linux 终端上或在 HTML 文件中)。 In Eclipse the encoding for the Console view is set in the run configuration in the tab Common .在 Eclipse中,控制台视图的编码是在选项卡Common运行配置中设置的。

In this case the solution exactly was:在这种情况下,解决方案正是:

BufferedReader b = new BufferedReader(new InputStreamReader(isFile, StandardCharsets.UTF_8)); BufferedReader b = new BufferedReader(new InputStreamReader(isFile, StandardCharsets.UTF_8));

De ese mmodo obligas a que lea por defecto en UTF_8 y no dependas del resto de configuraciones在 UTF_8 中没有依赖于配置文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM