在Ubuntu 11.04中运行Javac时出错 [英] Error running javac in Ubuntu 11.04

查看:190
本文介绍了在Ubuntu 11.04中运行Javac时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Ubuntu 11.04中安装JDK 1.7,但是当我运行以下命令时:

I'm trying to install JDK 1.7 in Ubuntu 11.04 but when I run the following command:

javac -version

我在下面遇到错误:

Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

以下是一些有关我的系统配置的信息,可以解决您的问题:

here is some information about my system configuration for you in order to solve my problem:

/etc/profile的结尾:

The end of /etc/profile:

JDK_HOME=/usr/local/java/jdk1.7.0_04
PATH=$PATH:$HOME/bin:$JDK_HOME/bin
JAVA_HOME=/usr/local/java/jre1.7.0_04
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JDK_HOME
export JAVA_HOME
export PATH

/etc/ld.conf.so.d/java.conf的输出:

output of /etc/ld.conf.so.d/java.conf :

/usr/local/java/jre1.7.0_04/lib/i386/
/usr/local/java/jre1.7.0_04/lib/i386/jli/

$ PATH的输出:

output of $PATH:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/sahar/bin:/usr/local/java/jdk1.7.0_04/bin:/home/sahar/bin:/usr/local/java/jre1.7.0_04/bin

请帮助我解决问题.

推荐答案

您的JAVA_HOME和PATH在您的etc配置文件中写入了两次,第二次用jre JAVA_HOME覆盖了它,因此javac将无法工作.在etc/profile的末尾取出第二个JAVA_HOME和PATH分配,然后重新启动

Your JAVA_HOME and PATH are being written twice in your etc profile, and the second time is overwriting it with the jre JAVA_HOME so javac will not work. Take out the second JAVA_HOME and PATH assignment at the end of your etc/profile and reboot

这篇关于在Ubuntu 11.04中运行Javac时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆