Home > Java > JavaBase > body text

Solution to garbled code when using jar package in java

Release: 2019-12-12 10:13:21
Original
5289 people have browsed it

Solution to garbled code when using jar package in java

Solution to garbled code in java using jar package:

1. Modify the default encoding of text files in Eclipse: windows->Preferences->general->Workspace ->Text file encoding is set to UTF-8.

Modify the default encoding of JAVA source files: windows->Preferences->general->Content Types->Context Types tree on the right, click on Text, select Java Source File, and click Default below Enter UTF-8 in the encoding input box and click Update.

Remember to restart eclipse after the last modification, it will take effect after restarting.

2. Just add encoding when referencing the jar package

java -Dfile.encoding=utf-8 -jar demo.jar

Please follow us for more java knowledgejavaBasic Tutorial column.

The above is the detailed content of Solution to garbled code when using jar package in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template