1 # Building Babylon
2 [Back to Index ../](../index.md)
3
4 OpenJDK Babylon can be found here [https://github.com/openjdk/babylon](https://github.com/openjdk/babylon)
5
6 If you follow the steps below to build Babylon, you should not have to
7 change any of the `maven` or `cmake` build files for hat.
8
9 ## Some useful vars
10 You will need an existing version of JDK to build Babylon and [jtreg](https://github.com/openjdk/jtreg).
11
12 The following build process assumes you have an env var called
13 `BOOT_JDK` set to an existing JDK ([JDK 26+](https://jdk.java.net/26/)).
14
15 For example assuming you have just installed java 26 on your machine into `${HOME}/java/jdk-26.jdk`
16 ```bash
17 export BOOT_JDK=${HOME}/java/jdk-26.jdk/Contents/Home/
18 ```
19
20 We will also assume that you have a `GITHUB` var pointing to location where you pull
21 repo's from GITHUB.
22
23 For example I always pull all my Babylon/HAT related repos in `${HOME}/github` so..
24 ```bash
25 export GITHUB=${HOME}/github
26 ```
27
28 ### Clone jtreg from GitHub ([https://github.com/openjdk/jtreg](https://github.com/openjdk/jtreg))
29 ```bash
30 cd ${GITHUB}
31 git clone https://github.com/openjdk/jtreg
32 ```
33 ### Build jtreg
34 ```bash
35 export JTREG_ROOT=${GITHUB}/jtreg
36 cd ${JTREG_ROOT}
37 bash make/build.sh --jdk ${BOOT_JDK}
38 ```
39 We will need to point a var called JTREG at the resulting image
40
41 ```bash
42 export JTREG_HOME=${JTREG_ROOT}/build/images/jtreg
43 ```
44
45 ### Clone Babylon from GitHub ([https://github.com/opendjk/babylon.git](https://github.com/opendjk/babylon.git))
46 ```bash
47 cd ${GITHUB}
48 git clone https://github.com/opendjk/babylon.git
49 ```
50 ### Configure Babylon
51 ```bash
52 cd ${GITHUB}/babylon
53 bash configure --with-boot-jdk=${BOOT_JDK} --with-jtreg=${JTREG_HOME}
54 ```
55 If you have never built JDK before you may find that the `configure` step will suggest packages to install.
56 I usually just keep running `bash configure` and take the suggestions (missing packages) I you get a successful Babylon build.
57
58 ### Build Babylon
59
60 ```bash
61 make clean
62 make images
63 #Coffee time (between 2 mins and 10 mins usually depends on your machine)
64 ```
65 You now should have:
66
67 ```bash
68 github
69 ├── babylon
70 │ ├── build
71 │ │ └── XXXX-server-release
72 │ │ ├── Makefile
73 │ │ ├── jdk
74 │ │ ├── images
75 │ │ ├── hotspot
76 │ │ └── ...
77 │ ├── hat
78 │ │ ├── ...
79 ```
80
81 Where XXXX will depend on your architecture AARCH64 or X64_86
82
83 ### Run can now JTREG Tests
84 If we included `jtreg` above we can run the `babylon` code reflection tests using
85 ```bash
86 cd ${GITHUB}/babylon
87 make test TEST=jdk_lang_reflect_code
88 ```
89 This works because babylon added added:
90 ```txt
91 8<-
92 jdk_lang_reflect_code = \
93 java/lang/reflect/code
94 ->8
95 ```
96 To the file `${GITHUB}/babylon/test/jdk/TEST.groups`
97
98 For the curious...the tests themselves can be found in this directory
99 ```bash
100 tree {GITHUB}/babylon}/test/jdk/java/lang/reflect/code
101 ```
102 [Next Building HAT](hat.md)