1. first go to the http://download.java.net/openjdk/jdk7/ to download the openjdk7 source code zip package
2. Install the compilation Toolkit If aptitude is not installed, install Aptitude (SUDO Apt-Get install aptitude) Sudo aptitude build-dep openjdk-6
3. Note: the language of the Ubuntu system must be switched to English (system settings-> language support) 4. Modify the MAKEFILE file in hotspot/make/Linux and comment out the following content. If no comment is made, an error is returned, and Exit 1 to exit Compilation:
check_os_version:#ifeq ($(DISABLE_HOTSPOT_OS_VERSION_CHECK)$(EMPTY_IF_NOT_SUPPORTED),)#$(QUIETLY) >&2 echo "*** This OS is not supported:" `uname -a`; exit 1;#endif 5. Modify the MAKEFILE file under JDK/make/javax/sound/jsoundalsa/and set LDFLAGS += -lasound Change Extra_libs + =-lasound Otherwise, the compilation fails. 6. Prepare the compilation Script: buildjdk. SH and place it in the root directory of openjdk source code. #!/bin/bashexport LANG=Cexport ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdkexport ALLOW_DOWNLOADS=trueexport USE_PRECOMPILED_HEADER=trueexport SKIP_DEBUG_BUILD=falseexport SKIP_FASTDEBUG_BUILD=trueexport DEBUG_NAME=debugunset CLASSPATHunset JAVA_HOME make sanity && make 7. Execute the compilation script./buildjdk. Sh 8. Check the result after compilation is completed.
-- Build times ----------Target debug_buildStart 2012-02-24 21:44:33End 2012-02-24 22:40:3200:00:52 corba00:23:09 hotspot00:09:25 jaxp00:08:38 jaxws00:13:01 jdk00:00:54 langtools00:55:59 TOTAL-------------------------make[1]: Leaving directory `/home/nathan/study/openjdk'nathan@ubuntu:~/study/openjdk$ build/linux-i586-debug/j2sdk-image/bin/java -versionopenjdk version "1.7.0-internal-debug"OpenJDK Runtime Environment (build 1.7.0-internal-debug-nathan_2012_02_24_20_17-b00)OpenJDK Server VM (build 21.0-b17-jvmg, mixed mode)
|
Refrence:
1: http://www.85java.com/viewthread.php? Tid = 20878
2. http://stackoverflow.com/questions/9048254/how-to-compile-an-openjdk-7-debug-build-on-ubuntu-11-10