简体   繁体   中英

Special characters are properly displayed in Eclipse but not in .jar file

This is my very first question on Stackoverflow.

I have developed a tool in Eclipse that receives an Excel file (.xls) and adds the content of some cells to a JList. The problem is when exporting the project to a Runnable JAR file, as all the special characters are shown as " " in the JList. However, they are properly displayed when running the application from the IDE. Please help ^^

OS: macOS High Sierra (v.10.13.1) Eclipse: Mars.1 Release (4.5.1)

So far I have tried the following -

  1. Run - Run Configurations - Common - Encoding - ISO-8859-1
  2. Run - Debug Configurations - Common - Encoding - ISO-8859-1
  3. Eclipse - Preferences - General - Workspace - Text file encoding - ISO-8859-1
  4. Even I went to the Eclipse folder and modified the file called "eclipse.ini"

FIXED!

By adding the following line: System.setProperty("file.encoding", "ISO-8859-1");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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