Compiling JDK 1.4.2 from source, under win32

Hi,

Here is how I compiled JDK 1.4.2 from source-code under win32. I hope this helps the many others who are interested in doing the same.

1) Download the sources from here: http://wwws.sun.com/software/communitysource/j2se/java2/download.html

Be sure to download *all* packages (SCSL source, SCSL binaries, mozilla binaries)

2) Download gnu make from here: http://ftp.gnu.org/pub/gnu/make/

3) Download Info-zip "zip" and "unzip" packages: http://www.info-zip.org/pub/infozip/UnZip.html and http://www.info-zip.org/pub/infozip/Zip.html

4) Request and evaluation copy of MKS Toolkit: http://www.mkssoftware.com/eval/

The key point here is that MKS Toolkit is a commercial product and even once you request an evaluation copy, it'll take a day or two for one of their salespeople to contact and harass you. Tell him whatever you must to get an evaluation copy out of him ("I might buy a copy in 3 months, honest!")... I personally wish Sun would move away from this commercial product and replace it with cygwin or something. It was very annoying getting past this stage.

5) Download the DirectX 9.0 SDK from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=124552ff-8363-47fd-8f3b-36c226e04c85&displaylang=en

Sun actually requires DirectX 7.0 SDK but I couldn't find a copy anywhere so we have no choice but use a newer copy. This is another issue Sun should really address.

6) Install DirectX SDK, MKS Toolkit, Info-zip zip and unzip

7) Unpack gnu make into a directory and build it using the special steps for the MKS Toolkit shell. If you're trying to build make 3.80 be sure to fix this bug before you proceed or else it won't build: https://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=1687

8) Set your build environment variables. Here are my personal settings:

call "C:\Program Files\Microsoft Visual Studio\VC98\Bin\vcvars32.bat"

set ALT_UNIXCOMMAND_PATH=c:\mksnt

set ALT_MSVCRT_DLL_PATH=c:\windows\system32

set ALT_BOOTDIR=c:\j2sdk1.4.2_04

set ALT_DEVTOOLS_PATH=c:\j2sdk1.4.2_04\source\utils

set path=C:\make-3.80\WinRel;%path%

set include=%include%;c:\program files\microsoft sdk\include

set JAVA_HOME=

9) You *must* build against Visual C++ 6.0 (Visual C++ .NET won't work because its missing non-standard header files used by Sun, such as iostream.h)

10) "cd <jdk source dir>\control\make"

11) Edit <jdk source dir>\j2me\make\common\Sanity.gmk line 1135. Replace:

ifeq ($(PLATFORM), windows)

with

ifeq ($(PLATFORM), windows_skip)

This will cause the build process to ignore the fact that you have DirectX 9.0 when it requires version 7.0

12) Start the build process: "make scsl"

13) If the build process dies because you have a different service-pack of Visual C++ 6.0 than it expects, edit <jdk source dir>\j2me\make\common\Sanity.gmk lines 71-72 and modify the expected version numbers to the ones you have.

14) If you see a "'c:\program' not found" error while compiling. Be sure that the paths set by VCVARS32.BAT use short-names not long-names, because make gets confused by paths with spaces.

15) If you see an error "No rule to make target `/usr/src/j2sdk-1_4_2-src-scsl/control/build/linux-i586/lib/fonts/LucidaTypewriterRegular.ttf'" it means you forgot to extract the "SCSL binaries" package into the source-code directory

I will post solutions to further compiler errors as I encounter them, I encourage you to do the same.

[3610 byte] By [cowwoc] at [2007-9-30 12:52:37]
# 1

I have found the information you provided extremely useful. I am trying to compile the J2sdk 1.4.2 also. If you had any additional information on this topic or knew of anywhere I might find more people working on this or similar projects I would be extremely greatful. Any help would be great as I am a relative novice to a project like this.

Thanks in advance,

Dave.

dave_barr at 2007-7-4 17:13:14 > top of Java-index,Administration Tools,Sun Connection...
# 2
Do you have similar steps of building jdk 1.4.2 on linux and netbsd ? Thanks Dheeraj dee_xlncy@yahoo.co.uk
dee_xlncy at 2007-7-4 17:13:14 > top of Java-index,Administration Tools,Sun Connection...
# 3

When I compile the jdk, I encounted the errors as following. Anybody have similar experience? Thanks a lot.

../../../src/share/native/java/lang/System.c(90) : error C2017: illegal escape sequence

../../../src/share/native/java/lang/System.c(90) : error C2115: 'function' : incompatible types

../../../src/share/native/java/lang/System.c(90) : warning C4024: 'function through pointer' : different types for forma

l and actual parameter 2

../../../src/share/native/java/lang/System.c(90) : error C2143: syntax error : missing ')' before 'constant'

../../../src/share/native/java/lang/System.c(90) : error C2017: illegal escape sequence

../../../src/share/native/java/lang/System.c(90) : error C2017: illegal escape sequence

../../../src/share/native/java/lang/System.c(90) : error C2059: syntax error : ')'

bfc_forever at 2007-7-4 17:13:14 > top of Java-index,Administration Tools,Sun Connection...
# 4

hey

i m trying to install JDK 1.5 from source under win XP

dev-sanity pass so i suppose i have all installed correctly

the problem is when i run the command "make scsl" to compile all

i got an error which is into "link.exe" at the begin of the compilation :

cd generated && NMAKE /NOLOGO /f C:\cygwin\Sources\hotspot\build\windows

\makefiles\generated.make DIR=.\generated BUILD_FLAVOR=product

link.exe kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib ad

vapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib Wsock32.lib winmm.lib /n

ologo /machine:I386 /opt:REF /opt:ICF,8 /map /debug /subsystem:console /out:adl

c.exe main.obj adlparse.obj archDesc.obj arena.obj dfa.obj dict2.obj filebuff.ob

j forms.obj formsopt.obj formssel.obj opcodes.obj output_c.obj output_h.obj

link: too many arguments

Try `link --help' for more information.

NMAKE : fatal error U1077: 'link.exe' : return code '0x1'

Stop.

NMAKE : fatal error U1077: 'cd' : return code '0x2'

Stop.

NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio\VC98\bin\n

make.exe"' : return code '0x2'

Stop.

make[3]: *** [generic_build2] Error 2

make[3]: Leaving directory `/Sources/hotspot/make'

make[2]: *** [product] Error 2

make[2]: Leaving directory `/Sources/hotspot/make'

make[1]: *** [hotspot-build] Error 2

make[1]: Leaving directory `/Sources/control/make'

make: *** [scsl-build] Error 2

i installed visual studio professional 6 sp3 as required ine the "build-windows-i586.html" file ! is the file link.exe incorrect in the pack 3?

Thanks

attonnnn at 2007-7-4 17:13:14 > top of Java-index,Administration Tools,Sun Connection...
# 5
fixed
attonnnn at 2007-7-4 17:13:14 > top of Java-index,Administration Tools,Sun Connection...