工作中要画些简单的思维导图,于是就安装了 FreeMind,不料它竟然给我报错:
$ freemind
[warning] /usr/bin/freemind: No java runtime was found
[error] /usr/bin/freemind: Unable to find an appropriate java runtime. See java_wrappers(7) for help
去查查报错原因,vim /usr/bin/freemind
:
151 if [ -r /usr/lib/java-wrappers/java-wrappers.sh ]
152 then # the Debian method
153 . /usr/lib/java-wrappers/java-wrappers.sh
154 require_java_runtime java6
从 151 ~ 154 行可知 freemind 想要 Java 6 。
记得当时装了 6 7 8 三个版本的 Java,确认一下:
$ update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-oracle/jre/bin/java 8 auto mode
1 /usr/lib/jvm/java-6-oracle/jre/bin/java 1 manual mode
* 2 /usr/lib/jvm/java-7-oracle/jre/bin/java 7 manual mode
3 /usr/lib/jvm/java-8-oracle/jre/bin/java 8 manual mode
Press enter to keep the current choice[*], or type selection number:
可知 Java 6 的目录为 /usr/lib/jvm/java-6-oracle 。
接下来改改配置:
$ sudo cp /usr/lib/java-wrappers/java-wrappers.sh /usr/lib/java-wrappers/java-wrappers.sh.freemind
$ sudo chmod 755 /usr/lib/java-wrappers/java-wrappers.sh.freemind
$ sudo vim /usr/lib/java-wrappers/java-wrappers.sh.freemind
,把第 99 行 # DIRS=""
修改为 DIRS="/usr/lib/jvm/java-6-oracle"
。
$ sudo vim /usr/bin/freemind
,把 java-wrappers.sh 替换为 java-wrappers.sh.freemind。替换后显示如下:
151 if [ -r /usr/lib/java-wrappers/java-wrappers.sh.freemind ]
152 then # the Debian method
153 . /usr/lib/java-wrappers/java-wrappers.sh.freemind
154 require_java_runtime java6
修改完毕,再次启动 FreeMind 一切都好了。
网友评论