我在试着运行一个 Apache Hive
web界面,所以我下载了ant的最新版本( Ant 1.9.4
),当我执行命令生成 hive.war
文件
ANT_LIB=/opt/ant/lib bin/hive --service hwi
我得到以下错误:
cp=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
cp=null
work dir=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
extension dir=/usr/lib/jvm/jdk1.7.0_65/jre/lib/ext:/usr/java/packages/lib/ext
srcDir=/tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp
compilerTargetVM=1.5
compilerSourceVM=1.5
include=org/apache/jsp/index_jsp.java
15/02/23 09:56:59 ERROR compiler.Compiler: Error compiling file: /tmp/Jetty_0_0_0_0_9999_hive.hwi.0.10.0.war__hwi__ae9cmk/jsp//org/apache/jsp/index_jsp.java [javac] warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
15/02/23 09:56:59 ERROR mortbay.log: /hwi/
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/jdk1.7.0_65/jre"
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:130)
at org.apache.tools.ant.taskdefs.Javac.findSupportedFileExtensions(Javac.java:984)
at org.apache.tools.ant.taskdefs.Javac.scanDir(Javac.java:961)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:932)
at org.apache.jasper.compiler.AntCompiler.generateClass(AntCompiler.java:220)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
我以root身份执行代码。我的 JAVA_HOME
正确设置在 .bashrc
:
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
export HADOOP_LIBEXEC_DIR=/usr/lib/hadoop/libexec
export HADOOP_CONF_DIR=/etc/hadoop/conf
export PATH=$PATH:$JAVA_HOME/bin
以及 .bash_profile
文件夹:
.bash\u配置文件
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_65
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export PATH
我想知道为什么 Ant
引用 javac
在 "/usr/lib/jvm/jdk1.7.0_65/jre"
. 此外,这是我的 JDK
结构:
[root@ip-10-32-205-19 ~]# cd $JAVA_HOME
[root@ip-10-32-205-19 jdk1.7.0_65]# ls -l
total 19760
drwxr-xr-x. 2 root root 4096 Feb 23 04:09 bin
-r--r--r--. 1 root root 3339 Jun 17 2014 COPYRIGHT
drwxr-xr-x. 4 root root 4096 Jun 17 2014 db
drwxr-xr-x. 3 root root 4096 Jun 17 2014 include
drwxr-xr-x. 5 root root 4096 Jun 17 2014 jre
drwxr-xr-x. 5 root root 4096 Feb 23 04:09 lib
-r--r--r--. 1 root root 40 Jun 17 2014 LICENSE
drwxr-xr-x. 4 root root 4096 Jun 17 2014 man
-r--r--r--. 1 root root 114 Jun 17 2014 README.html
-rw-r--r--. 1 root root 499 Jun 17 2014 release
-rw-r--r--. 1 root root 19902785 Jun 17 2014 src.zip
-rw-r--r--. 1 root root 110114 Jun 16 2014 THIRDPARTYLICENSEREADME-JAVAFX.txt
-r--r--r--. 1 root root 173559 Jun 17 2014 THIRDPARTYLICENSEREADME.txt
这说明我有 JDK
,而不仅仅是 JRE
安装。我也看了类似的问题,但没有一个能解决我的问题。这个 Java
是 64bits
,加上我也跑了 source
两者皆适用 .bashrc
以及 .bash_profile
.
1条答案
按热度按时间dwthyt8l1#
错误消息显示:
也许javau home并不指向jdk。当前设置为“/usr/lib/jvm/jdk1.7.0\u 65/jre”
但是,您的.bashrc具有:
导出java\u home=/usr/lib/jvm/jdk1.7.0\u 65
你可能需要逃跑
source ~/.bashrc
在bashshell中,将javau home重置为jdk安装的根目录。然后再跑蚂蚁。