javac:未找到命令 [英] javac : command not found

查看:2228
本文介绍了javac:未找到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用命令 yum install java 在我的 CentOS版本5.5 机器上安装了java。但我无法使用javac编译一个类。



我需要安装任何其他包吗?



我尝试找到 javac 可执行文件,但我无法找到它。



/ usr / bin / java 如下链接:

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

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



我已经看到以下输出 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
://pkgs.org/centos-5-rhel-5/centos-rhel-updates-x86_64/java-1.6.0-openjdk-1.6.0.0-1.16.b17.el5.x86_64.rpm.htmlrel = nofollow>不包含 javac 。对于 javac ,您必须安装 OpenJDK开发环境。您可以安装 java-devel java-1.6.0-openjdk-devel c> javac



顺便说一下:你可以找出哪个包提供 javac 使用 yum search ,例如

  su -c'yum提供javac'

另一个注意事项:使用 yum openjdk 只是一种安装JDK的可能性。许多人喜欢Sun / Oracle的原始SDK。请参见如何在CentOS上安装Java SDK?和其他链接。


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.

这篇关于javac:未找到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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