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

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

问题描述

我已经使用命令 yum install java 在我的 CentOS 5.5 机器上安装了 java.但是我无法使用 javac 编译一个类.

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?

我试图找到 javac 可执行文件,但我无法找到它.

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

/usr/bin/java 链接如下:
/usr/bin/java -> /etc/alternatives/java
/etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java

/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

我已经看到 yum list installed |grep 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

推荐答案

您只安装了 Java Runtime Environment (JRE),不提供javac.对于 javac,你必须安装 OpenJDK 开发环境.您可以安装 java-develjava-11-devel,它们都包含 javac.

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

顺便说一句:您可以通过 yum 搜索找出哪个包提供 javac,例如

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

su -c 'yum provides javac'

在更新的 CentOS 版本上,例如6 命令改为

on more recent releases of CentOS e.g. 6 the command changes to

su -c 'yum provides */javac'

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

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