java未找到命令,javac:未找到命令

在CentOS 5.5上使用yum install java仅安装了JRE,缺少javac编译器。要解决此问题,需要安装OpenJDK Development Environment,如java-devel或java-1.6.0-openjdk-devel,它们都包含javac。可以使用yum search查找提供javac的包。
摘要由CSDN通过智能技术生成

I have installed java in my CentOS release 5.5 machine using the command yum install java. But I am unable to compile a class using javac.

Do I need to install any other package?

I have tried to locate the javac executable but i am unable to locate it.

/usr/bin/java is linked as follows:

/usr/bin/java -> /etc/alternatives/java

/etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

I have seen the following output by yum list installed |grep java:

java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.16.b17.el5 installed

tzdata-java.x86_64 2011b-1.el5 installed

解决方案

You installed the Java Runtime Environment (JRE) only, which does not contain javac. For javac, you have to install the OpenJDK Development Environment. You can install java-devel or java-1.6.0-openjdk-devel, which both include javac.

By the way: you can find out which package provides javac with a yum search, e.g.

su -c 'yum provides javac'

Another note: using yum and openjdk is only one possibility to install the JDK. Many people prefer Sun/Oracle's "original" SDK. See How to install Java SDK on CentOS? and links for alternatives.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值