1. first go to the terminal (sudoapt-getinstallaptitude) sudoaptitudebuild-depopenjdk-63. Note: Ubuntu system language is required 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 notAptitude, first installAptitude(Sudo apt-get install aptitude)
Sudo aptitude build-dep openjdk-6
3. Note:: Ubuntu SystemLanguageRequiredSwitchToEnglish(SystemSet->LanguageSupported)
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 jdk/make/javax/sound/jsoundalsa/ Makefile file under
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/bash
- Export LANG = C
- Export ALT_BOOTDIR =/usr/lib/jvm/java-6-openjdk
- Export ALLOW_DOWNLOADS = true
- Export USE_PRECOMPILED_HEADER = true
- Export SKIP_DEBUG_BUILD = false
- Export SKIP_FASTDEBUG_BUILD = true
- Export DEBUG_NAME = debug
- Unset CLASSPATH
- Unset JAVA_HOME
- Make sanity & make
7. Execute the compilation script./buildjdk. sh
8. Check the result after compilation is completed.
- -- Build times ----------
- Target debug_build
- Start 2012-02-24 21:44:33
- End 22:40:32
- 00:00:52 corba
- 00:23:09 hotspot
- 00:09:25 jaxp
- 00:08:38 jaxws
- 00:13:01 jdk
- 00:00:54 langtools
- 00:55:59 TOTAL
- -------------------------
- Make [1]: Leaving directory '/home/nathan/study/openjdk'
- Nathan @ ubuntu :~ /Study/openjdk $ build/linux-i586-debug/j2sdk-image/bin/java-version
- Openjdk 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)