Help us understand the problem. What is going on with this article?

EshellでJava1.6の日本語文字化け対策

More than 5 years have passed since last update.

Emacsを再起動したら、何故かそれまで問題なかったEshell上での"javac"や"java"コマンド出力の日本語が文字化けするようになってしまった。
(おそらくTerminalを再起動した際、javaのバージョンが切り替わってしまったと思われる。)

調べたら、JDK1.6のデフォルトのエンコーディングがSJISのため、コマンドオプションでutf-8を指定すれば良いっぽい。
参考:MacのTerminalでjavacをした時にコンパイルエラーが文字化けするの出なおしてみた

.emacsで以下のエイリアスを設定した

.emacs
(require 'em-alias)
(add-to-list 'eshell-command-aliases-list (list "javac" "javac -J-Dfile.encoding=UTF-8 $1")
(add-to-list 'eshell-command-aliases-list (list "java" "java -Dfile.encoding=UTF-8 $1")

(追記)
http://d.hatena.ne.jp/snaka72/20120101/1325403702
aliasで設定するより、"JAVA_TOOL_OPTIONS"にオプションを渡す方がよいっぽい。

.bashrc
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8

これで、"java""javac"どちらにもオプションが渡される。

…結局Emacs関係ないです。。。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away