Specify encoding in manifest file

眉间皱痕 提交于 2019-12-11 05:53:59

问题


I created a jar using the Export functionality in Eclipse and when I try to execute it in the following way it fails

java -jar Code.jar

However it works correctly for

java -Dfile.encoding=UTF-8 -jar Code.jar

Current manifest file

Manifest-Version: 1.0
Main-Class: test.Reader
Class-Path: .

How can I mention the encoding inside the manifest file? So that I dont have to mention it explicitly while running the jar file?


回答1:


This indicates a problem with your code. Your code is currently depending on the default platform encoding, and doesn't work if that encoding is not "UTF-8". therefore, you should change the places in your code which depend on the default platform encoding to use the "UTF-8" encoding explicitly.

and, no, you can't specify that in the manifest.



来源:https://stackoverflow.com/questions/14867281/specify-encoding-in-manifest-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!