ubuntu 正确安装jdk后,eclipse从快捷方式打开找不到jvm

今天重装系统,碰到了个古怪的问题,在正确配置好jdk路径后,解压缩版的eclipse能从命令行正常启动,从快捷方式启动时却提示找不到java路径。经过一番苦找之后,从正确安装jdk后,eclipse找不到jdk路径找到答案,原来建立eclipse快捷方式以后,从快捷方式启动,出现找不到jvm的情况,是因为eclipse默认从系统原来的jdk去找jvm。执行一下操作即可。

sudo update-alternatives –install /usr/bin/java java /usr/local/java/1.7/jdk1.7.0_21/bin/java 300
sudo update-alternatives –install /usr/bin/javac javac /usr/local/java/1.7/jdk1.7.0_21/bin/javac 300
sudo update-alternatives –install /usr/bin/jar jar /usr/local/java/1.7/jdk1.7.0_21/bin/jar 300
sudo update-alternatives –install /usr/bin/javah javah /usr/lib/jvm/java-7-sun/bin/javah 300
sudo update-alternatives –install /usr/bin/javap javap /usr/lib/jvm/java-7-sun/bin/javap 300

你可能感兴趣的:(ubuntu)