我不是小白脸 2018-11-06 12:06 采纳率: 20%
浏览 6468
已采纳

编译jdk1.7时发生错误:Unsupported major.minor version 52.0

今天试着编译jdk1.7。make sanity都check passed了,可是在make时,就发生这个错误:

make[2]: Entering directory '/home/fengli/Downloads/MyOpenJdk7/langtools/make'
JAVA_HOME=/usr/lib/jdk1.6.0_32 ANT_OPTS=-Djava.io.tmpdir='/home/fengli/Downloads/MyOpenJdk7/build/langtools/build/ant-tmp' /usr/lib/apache-ant-1.10.3/bin/ant -Djdk.version=1.7.0 -Dfull.version='1.7.0-internal-root_2018_11_06_19_55-b00' -Dmilestone=internal -Dbuild.number=b00 -Djavac.target=7 -Djavac.source=7 -Dboot.java.home=/usr/lib/jdk1.6.0_32 -Dimport.jdk=/home/fengli/Downloads/MyOpenJdk7/jdk -Dbuild.dir=/home/fengli/Downloads/MyOpenJdk7/build/langtools/build -Ddist.dir=/home/fengli/Downloads/MyOpenJdk7/build/langtools/dist build
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
Makefile:201: recipe for target 'build' failed
make[2]: *** [build] Error 1
make[2]: Leaving directory '/home/fengli/Downloads/MyOpenJdk7/langtools/make'
make/langtools-rules.gmk:37: recipe for target 'langtools-build' failed
make[1]: *** [langtools-build] Error 2
make[1]: Leaving directory '/home/fengli/Downloads/MyOpenJdk7'
Makefile:244: recipe for target 'build_product_image' failed
make: *** [build_product_image] Error 2

我/etc/profile是这样的:

/etc/profile: system-wide .profile file for the Bourne shell (sh(1))

and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
# The file bash.bashrc already sets the default PS1.
# PS1='\h:\w\$ '
if [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
fi
else
if [ "id -u" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
fi

if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi

jdk1.8

#export JAVA_HOME=/usr/lib/jdk1.8.0_191
#export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
#export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

jdk1.7

#export JAVA_HOME=/usr/lib/jdk1.7.0_80
#export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
#export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

jdk1.6

export JAVA_HOME=/usr/lib/jdk1.6.0_32
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

#set Ant enviroment
export ANT_HOME=/usr/lib/apache-ant-1.10.3
export PATH=$PATH:$ANT_HOME/bin

for jdk7 compile

export LANG=C
#BootStrap-JDK
export ALT_BOOTDIR=/usr/lib/jdk1.6.0_32
#OracleJDK
export ALT_JDK_IMPORT_PATH=/usr/lib/jdk1.6.0_32
#
export ALLOW_DOWNLOADS=true
#the same with you cup cores
export HOTSPOT_BUILD_JOBS=2
export ALT_PARALLEL_COMPILE_JOBS=2
#
export USE_PRECOMPILED_HEADER=true
#
export BUILD_LANGTOOLS=true
export BUILD_JAXWS=false
#export BUILD_JAXP=false
#export BUILD_CORBA=false
export BUILD_HOTSPOT=true

export BUILD_JDK=true

export SKIP_COMPARE_IMAGES=true
#
BUILD_DEPLOY=false
#
BUILD_INSTALL=false
#
export ALT_OUTPUTDIR=/home/fengli/Downloads/MyOpenJdk7/build
#
unset JAVA_HOME
unset CLASSPATH
#
make 2>&1 | tee $ALT_OUTPUTDIR/build.log

  • 写回答

3条回答 默认 最新

  • 我不是小白脸 2018-11-06 13:25
    关注

    我已经知道了。还是谢谢了哈!!!。原因是apache-ant-1.10.3需要jdk8支持,我吧它改成apache-ant-1.7.1就行了(-_-)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 找一个QT页面+目标识别(行人检测)的开源项目
  • ¥15 有没有整苹果智能分拣线上图像数据
  • ¥20 有没有人会这个东西的
  • ¥15 cfx考虑调整“enforce system memory limit”参数的设置
  • ¥30 航迹分离,航迹增强,误差分析
  • ¥15 Chrome Manifest扩展引用Ajax-hook库拦截请求失败
  • ¥15 用Ros中的Topic通讯方式控制小乌龟的速度,走矩形;编写订阅器代码
  • ¥15 LLM accuracy检测
  • ¥15 pycharm添加远程解释器报错
  • ¥15 如何让子窗口鼠标滚动独立,不要传递消息给主窗口