Skip to content

Commit 1315702

Browse files
committed
Use JDK 8 for core builds
1 parent 9e6e1d2 commit 1315702

File tree

4 files changed

+29
-28
lines changed

4 files changed

+29
-28
lines changed

BUILDING.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide explains how to build Codename One and its Android and iOS ports loca
44

55
## Prerequisites
66

7-
- **JDK 11** (Codename One also builds with JDK 8, but these steps use JDK 11)
7+
- **JDK 8**
88
- **JDK 17** for building the Android port
99
- **Apache Maven 3.6+**
1010
- macOS with Xcode (required only for the iOS port)
@@ -16,10 +16,10 @@ The helper scripts in the `scripts/` directory download these dependencies when
1616
Download binaries from [Adoptium](https://adoptium.net):
1717

1818
```bash
19-
# JDK 11 (Linux x64; adjust `_x64_linux_` for your platform)
20-
curl -L -o temurin11.tar.gz https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.28%2B6/OpenJDK11U-jdk_x64_linux_hotspot_11.0.28_6.tar.gz
21-
tar xf temurin11.tar.gz
22-
export JAVA_HOME=$PWD/jdk-11.0.28+6
19+
# JDK 8 (Linux x64; adjust `_x64_linux_` for your platform)
20+
curl -L -o temurin8.tar.gz https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u462b08.tar.gz
21+
tar xf temurin8.tar.gz
22+
export JAVA_HOME=$PWD/jdk8u462-b08
2323

2424
# JDK 17 (Linux x64; adjust `_x64_linux_` for your platform)
2525
curl -L -o temurin17.tar.gz https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.16_8.tar.gz
@@ -31,7 +31,7 @@ export PATH="$JAVA_HOME/bin:$PATH"
3131

3232
## Preparing the workspace
3333

34-
Clone the repository and run the setup script to download JDK 11 and JDK 17, install Maven, build the core modules, and install the Maven archetypes. This step must be performed before building any ports.
34+
Clone the repository and run the setup script to download JDK 8 and JDK 17, install Maven, build the core modules, and install the Maven archetypes. This step must be performed before building any ports.
3535

3636
```bash
3737
git clone https://github.com/codenameone/CodenameOne
@@ -44,7 +44,7 @@ The script runs `mvn install` in `maven/`, installs `cn1-maven-archetypes`, and
4444

4545
## Building the Android port
4646

47-
The Android port uses JDK 17 for compilation while Maven runs with JDK 11. Run the build script:
47+
The Android port uses JDK 17 for compilation while Maven runs with JDK 8. Run the build script:
4848

4949
```bash
5050
./scripts/build-android-port.sh -DskipTests
@@ -64,9 +64,9 @@ Artifacts are produced in `maven/ios/target`.
6464

6565
## Convenience scripts
6666

67-
- `setup-workspace.sh` – installs Maven, downloads JDK 11 and JDK 17, builds the core modules, installs Maven archetypes, provisions the Codename One build client, and writes `tools/env.sh`.
68-
- `build-android-port.sh` – builds the Android port using JDK 11 for Maven and JDK 17 for compilation.
69-
- `build-ios-port.sh` – builds the iOS port on macOS with JDK 11.
67+
- `setup-workspace.sh` – installs Maven, downloads JDK 8 and JDK 17, builds the core modules, installs Maven archetypes, provisions the Codename One build client, and writes `tools/env.sh`.
68+
- `build-android-port.sh` – builds the Android port using JDK 8 for Maven and JDK 17 for compilation.
69+
- `build-ios-port.sh` – builds the iOS port on macOS with JDK 8.
7070

7171
## Further reading
7272

scripts/build-android-port.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# Build Codename One Android port using JDK 11 for Maven and JDK 17 for compilation
2+
# Build Codename One Android port using JDK 8 for Maven and JDK 17 for compilation
33
set -euo pipefail
44
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
55
cd "$ROOT"
@@ -11,21 +11,19 @@ else
1111
source "$ROOT/tools/env.sh"
1212
fi
1313

14-
if ! "$JAVA_HOME/bin/java" -version 2>&1 | grep -q '11\.0'; then
15-
echo "JAVA_HOME is not JDK 11; running setup-workspace.sh" >&2
14+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8'; then
1615
./scripts/setup-workspace.sh -q -DskipTests
1716
source "$ROOT/tools/env.sh"
1817
fi
19-
if ! "$JAVA_HOME/bin/java" -version 2>&1 | grep -q '11\.0'; then
20-
echo "Failed to provision JDK 11" >&2
18+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8'; then
19+
echo "Failed to provision JDK 8" >&2
2120
exit 1
2221
fi
23-
if ! "$JAVA_HOME_17/bin/java" -version 2>&1 | grep -q '17\.0'; then
24-
echo "JAVA_HOME_17 is not JDK 17; running setup-workspace.sh" >&2
22+
if ! "${JAVA_HOME_17:-}/bin/java" -version 2>&1 | grep -q '17\.0'; then
2523
./scripts/setup-workspace.sh -q -DskipTests
2624
source "$ROOT/tools/env.sh"
2725
fi
28-
if ! "$JAVA_HOME_17/bin/java" -version 2>&1 | grep -q '17\.0'; then
26+
if ! "${JAVA_HOME_17:-}/bin/java" -version 2>&1 | grep -q '17\.0'; then
2927
echo "Failed to provision JDK 17" >&2
3028
exit 1
3129
fi

scripts/build-ios-port.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ else
1717
./scripts/setup-workspace.sh -q -DskipTests
1818
source "$ROOT/tools/env.sh"
1919
fi
20-
if ! "$JAVA_HOME/bin/java" -version 2>&1 | grep -q '11\.0'; then
21-
echo "JAVA_HOME is not JDK 11; running setup-workspace.sh" >&2
20+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8'; then
2221
./scripts/setup-workspace.sh -q -DskipTests
2322
source "$ROOT/tools/env.sh"
2423
fi
25-
if ! "$JAVA_HOME/bin/java" -version 2>&1 | grep -q '11\.0'; then
26-
echo "Failed to provision JDK 11" >&2
24+
if ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8'; then
25+
echo "Failed to provision JDK 8" >&2
2726
exit 1
2827
fi
2928
export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH"

scripts/setup-workspace.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
#!/usr/bin/env bash
2-
# Prepare Codename One workspace by installing Maven, provisioning JDK 11 and JDK 17,
2+
# Prepare Codename One workspace by installing Maven, provisioning JDK 8 and JDK 17,
33
# building core modules, and installing Maven archetypes.
44
set -euo pipefail
55
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
66
TOOLS="$ROOT/tools"
77
mkdir -p "$TOOLS"
88

9+
JAVA_HOME="${JAVA_HOME:-}"
10+
JAVA_HOME_17="${JAVA_HOME_17:-}"
11+
MAVEN_HOME="${MAVEN_HOME:-}"
12+
913
os_name=$(uname -s)
1014
arch_name=$(uname -m)
1115
case "$os_name" in
@@ -19,7 +23,7 @@ case "$arch_name" in
1923
*) echo "Unsupported architecture: $arch_name" >&2; exit 1 ;;
2024
esac
2125

22-
JDK11_URL="https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.28%2B6/OpenJDK11U-jdk_${arch}_${os}_hotspot_11.0.28_6.tar.gz"
26+
JDK8_URL="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u462-b08/OpenJDK8U-jdk_${arch}_${os}_hotspot_8u462b08.tar.gz"
2327
JDK17_URL="https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.16%2B8/OpenJDK17U-jdk_${arch}_${os}_hotspot_17.0.16_8.tar.gz"
2428
MAVEN_URL="https://archive.apache.org/dist/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz"
2529

@@ -39,12 +43,12 @@ install_jdk() {
3943
eval "$dest_var=\"$home\""
4044
}
4145

42-
if ! [ -x "${JAVA_HOME:-}/bin/java" ] || ! "$JAVA_HOME/bin/java" -version 2>&1 | grep -q '11\.0'; then
43-
echo "Provisioning JDK 11 (this may take a while)..."
44-
install_jdk "$JDK11_URL" JAVA_HOME
46+
if [ ! -x "${JAVA_HOME:-}/bin/java" ] || ! "${JAVA_HOME:-}/bin/java" -version 2>&1 | grep -q '1\.8'; then
47+
echo "Provisioning JDK 8 (this may take a while)..."
48+
install_jdk "$JDK8_URL" JAVA_HOME
4549
fi
4650

47-
if ! [ -x "${JAVA_HOME_17:-}/bin/java" ] || ! "$JAVA_HOME_17/bin/java" -version 2>&1 | grep -q '17\.0'; then
51+
if [ ! -x "${JAVA_HOME_17:-}/bin/java" ] || ! "${JAVA_HOME_17:-}/bin/java" -version 2>&1 | grep -q '17\.0'; then
4852
echo "Provisioning JDK 17 (this may take a while)..."
4953
install_jdk "$JDK17_URL" JAVA_HOME_17
5054
fi

0 commit comments

Comments
 (0)