I have a program that uses certain characters (arrows, gender symbols) that are not typically supported. When compiling in Eclipse, I just choose "save as UTF-8" and it works fine. However, when I'm in the console trying to compile (using javac *.java or something to that effect) it throws an error because of those UTF-8 characters. How do I adjust the way I compile so it is able to use the UTF-8 characters?
Asked
Active
Viewed 653 times
2 Answers
0
Creating JAR
file is mainly like archiving the .class
files so you should not get any error because of UTF-8
characters in source files.
For resolving compilation error due to UTF-8
characters, use -encoding
argument for specifying source files encoding -
javac SourceJavaFile.java -encoding UTF-8

Vikas Sachdeva
- 5,633
- 2
- 17
- 26
0
You can create a JAR file using eclipse natively by right-clicking on your project and then selecting Export. From there you can expand the Java node and select the JAR File type, and configure it from there. Reference here from the eclipse website for a full instruction of using the built-in JAR File maker on eclipse. I hope this allows for the use of UTF-8 exclusive characters which you are using.