linux ubuntu编译 openjdk11
- 下载openjdk
https://github.com/openjdk/jdk11u/tags 选择gz压缩包,而不是zip - 安装jdk11
https://www.oracle.com/java/technologies/downloads/#java11 - 安装依赖库
sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev libasound2-dev libcups2-dev
- 编译
chmod +x configure
./configure
make
编译成功
Compiling 4 files for BUILD_JIGSAW_TOOLS
Stopping sjavac server
Finished building target 'default (exploded-image)' in configuration 'linux-x86_64-normal-server-release'
- 产物位置
build/linux-x86_64-normal-server-release/jdk/bin - 报错解决
Building target 'default (exploded-image)' in configuration 'linux-x86_64-normal-server-release'
Warning: No SCM configuration present and no .src-rev
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
warning: [path] bad path element "/usr/share/java/stringtemplate4.jar": no such file or directory
warning: [path] bad path element "/usr/share/java/stringtemplate.jar": no such file or directory
warning: [path] bad path element "/usr/share/java/antlr3.jar": no such file or directory
warning: [path] bad path element "/usr/share/java/antlr3-runtime.jar": no such file or directory
warning: [path] bad path element "/home/fukaiqiang/bin/Linux/ext/antlrworks.jar": no such file or directory
error: warnings found and -Werror specified
1 error
5 warnings
make[3]: *** [ToolsLangtools.gmk:40: /media/fukaiqiang/xijie/code/jdk11u-jdk-11.0.25-5/build/linux-x86_64-normal-server-release/buildtools/langtools_tools_classes/_the.BUILD_TOOLS_LANGTOOLS_batch] Error 1
make[2]: *** [make/Main.gmk:73: buildtools-langtools] Error 2
make[2]: *** Waiting for unfinished jobs....
ERROR: Build failed for target 'default (exploded-image)' in configuration 'linux-x86_64-normal-server-release' (exit code 2)
=== Output from failing command(s) repeated here ===
* For target buildtools_langtools_tools_classes__the.BUILD_TOOLS_LANGTOOLS_batch:
warning: [path] bad path element "/usr/share/java/stringtemplate4.jar": no such file or directory
warning: [path] bad path element "/usr/share/java/stringtemplate.jar": no such file or directory
warning: [path] bad path element "/usr/share/java/antlr3.jar": no such file or directory
warning: [path] bad path element "/usr/share/java/antlr3-runtime.jar": no such file or directory
warning: [path] bad path element "/home/fukaiqiang/bin/Linux/ext/antlrworks.jar": no such file or directory
error: warnings found and -Werror specified
1 error
5 warnings
* All command lines available in /media/fukaiqiang/xijie/code/jdk11u-jdk-11.0.25-5/build/linux-x86_64-normal-server-release/make-support/failure-logs.
=== End of repeated output ===
No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See doc/building.html#troubleshooting for assistance.
如果遇到以上错误,执行unset CLASSPATH和unset JAVA_HOME,然后再执行make编译
8. 参考
https://blog.csdn.net/quantum7/article/details/125064687