Skip to content

Commit 3ff9c4c

Browse files
Talbot3bytemain
andauthored
fix: arm64 architecture support - foojay API expects aarch64 (#46)
* fix: support arm64 architecture and exact version matching - Convert arm64 to aarch64 for foojay API compatibility - Remove latest=available parameter to ensure exact version matching - Improve error handling when no JDK is found * docs: update README with correct usage syntax --------- Co-authored-by: Jiacheng <artin@cat.ms>
1 parent c9b5862 commit 3ff9c4c

File tree

3 files changed

+37
-28
lines changed

3 files changed

+37
-28
lines changed

README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@ Support for multiple JDK distributions, such as: Oracle, Graalvm, Eclipse & more
99

1010
# Usage
1111

12-
**Parameter Format**: x.y.z-distribution
12+
**Parameter Format**: `x.y.z-distribution`
1313

1414
```shell
1515
# add plugin for vfox
1616
vfox add java
1717

18-
# add runtime
19-
vfox install java@x.y.z # Use openjdk as default distribution.
20-
vfox install java@x.y.z-graal # Use graalvm as distribution.
18+
# install specific version (openjdk is default)
19+
vfox install java@17.0.17
20+
vfox install java@17.0.17-tem # Temurin
21+
vfox install java@17.0.17-zulu # Zulu
22+
vfox install java@17-graal # GraalVM (latest 17.x)
2123

2224
# view all available versions
23-
vfox search java all # view all java sdks
24-
vfox search java # view all for openjdk
25-
vfox search java graal # view all for graalvm
25+
vfox search java # view all openjdk versions
26+
vfox search java tem # view all temurin versions
27+
vfox search java zulu # view all zulu versions
28+
vfox search java graal # view all graalvm versions
2629
```
2730

2831
# Supported JDK Distributions
@@ -33,39 +36,39 @@ vfox search java graal # view all for graalvm
3336
BiSheng JDK, an open-source adaptation of Huawei JDK derived from OpenJDK, is utilized across 500+ Huawei products, benefitting from the R&D team's extensive experience in addressing service-related challenges. As a downstream product of OpenJDK, it serves as a high-performance distribution for production environments, specifically addressing performance and stability issues in Huawei applications. BiSheng JDK excels in optimizing ARM architecture performance and stability, delivering enhanced results in big data scenarios. Its primary goal is to offer Java developers a stable, high-performance JDK, particularly excelling on the ARM architecture.
3437

3538
```shell
36-
$ vfox install java x.y.z-bsg
39+
$ vfox install java@x.y.z-bsg
3740
$ vfox search java bsg
3841
```
3942

4043
## Corretto (Amazon)
4144
Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK). Corretto comes with long-term support that will include performance enhancements and security fixes. Amazon runs Corretto internally on thousands of production services and Corretto is certified as compatible with the Java SE standard. With Corretto, you can develop and run Java applications on popular operating systems, including Linux, Windows, and macOS.
4245

4346
```shell
44-
$ vfox install java x.y.z-amzn
47+
$ vfox install java@x.y.z-amzn
4548
$ vfox search java amzn
4649
```
4750

4851
## Dragonwell (Alibaba)
4952
Dragonwell, as a downstream version of OpenJDK, is the in-house OpenJDK implementation at Alibaba. It is optimized for online e-commerce, financial and logistics applications running on 100,000+ servers. Alibaba Dragonwell is the engine that runs these distributed Java applications in extreme scaling.
5053

5154
```shell
52-
$ vfox install java x.y.z-albba
55+
$ vfox install java@x.y.z-albba
5356
$ vfox search java albba
5457
```
5558

5659
## GraalVM (Oracle)
5760
Oracle GraalVM is the free GraalVM distribution from Oracle, based on Oracle JDK, and includes the high-performance Graal JIT compiler. GraalVM can compile Java applications ahead of time into standalone binaries that start instantly, scale fast, and use fewer compute resources. Oracle GraalVM Native Image provides advanced features including G1 GC, SBOM, as well as performance and size optimizations. It also makes it possible to embed Python, JavaScript, Ruby, and other languages into Java applications.
5861

5962
```shell
60-
$ vfox install java x.y.z-graal
63+
$ vfox install java@x.y.z-graal
6164
$ vfox search java graal
6265
```
6366

6467
## GraalVM (GraalVM Community)
6568
GraalVM CE is the open source distribution of GraalVM, based on OpenJDK, and includes the high-performance Graal JIT compiler. GraalVM can compile Java applications ahead of time into standalone binaries that start instantly, scale fast, and use fewer compute resources. It also makes it possible to embed Python, JavaScript, Ruby, and other languages into Java applications.
6669

6770
```shell
68-
$ vfox install java x.y.z-graalce
71+
$ vfox install java@x.y.z-graalce
6972
$ vfox search java graalce
7073
```
7174

@@ -74,15 +77,15 @@ This proprietary Java Development Kit is an implementation of the Java Platform,
7477

7578

7679
```shell
77-
$ vfox install java x.y.z-oracle
80+
$ vfox install java@x.y.z-oracle
7881
$ vfox search java oracle
7982
```
8083

8184
## Kona (Tencent)
8285
Tencent Kona is a free, multi-platform, and production-ready distribution of OpenJDK, featuring Long-Term Support (LTS) releases. It serves as the default JDK within Tencent for cloud computing, big data, and numerous other Java applications.
8386

8487
```shell
85-
$ vfox install java x.y.z-kona
88+
$ vfox install java@x.y.z-kona
8689
$ vfox search java kona
8790
```
8891

@@ -91,7 +94,7 @@ Liberica is a 100% open-source Java implementation. It is built from OpenJDK whi
9194

9295

9396
```shell
94-
$ vfox install java x.y.z-librca
97+
$ vfox install java@x.y.z-librca
9598
$ vfox search java librca
9699
```
97100

@@ -100,7 +103,7 @@ Liberica Native Image Kit is a utility that converts your JVM-based application
100103

101104

102105
```shell
103-
$ vfox install java x.y.z-nik
106+
$ vfox install java@x.y.z-nik
104107
$ vfox search java nik
105108
```
106109

@@ -109,7 +112,7 @@ Mandrel focuses on GraalVM's native-image component in order to provide an easy
109112

110113

111114
```shell
112-
$ vfox install java x.y.z-mandrel
115+
$ vfox install java@x.y.z-mandrel
113116
$ vfox search java mandrel
114117
```
115118

@@ -118,62 +121,62 @@ $ vfox search java mandrel
118121
OpenJDK (Open Java Development Kit) is a free and open-source implementation of the Java Platform, Standard Edition (Java SE). It is the result of an effort Sun Microsystems began in 2006. The implementation is licensed under the GNU General Public License (GNU GPL) version 2 with a linking exception. Were it not for the GPL linking exception, components that linked to the Java class library would be subject to the terms of the GPL license. OpenJDK is the official reference implementation of Java SE since version 7.
119122

120123
```shell
121-
$ vfox install java x.y.z-open
124+
$ vfox install java@x.y.z-open
122125
$ vfox search java open
123126
```
124127

125128
## OpenJDK (Microsoft)
126129
The Microsoft Build of OpenJDK is a no-cost distribution of OpenJDK that's open source and available for free for anyone to deploy anywhere. It includes Long-Term Support (LTS) binaries for Java 11 on x64 server and desktop environments on macOS, Linux, and Windows, and AArch64/ARM64 on Linux and Windows. Microsoft also publishes Java 16 binaries for all three major Operating Systems and both x64 and AArch64 (M1/ARM64) architectures.
127130

128131
```shell
129-
$ vfox install java x.y.z-ms
132+
$ vfox install java@x.y.z-ms
130133
$ vfox search java ms
131134
```
132135
## SapMachine (SAP)
133136
SapMachine is a downstream version of the OpenJDK project. It is used to build and maintain a SAP supported version of OpenJDK for SAP customers and partners who wish to use OpenJDK to run their applications. SAP is committed to ensuring the continued success of the Java platform.
134137

135138

136139
```shell
137-
$ vfox install java x.y.z-sapmchn
140+
$ vfox install java@x.y.z-sapmchn
138141
$ vfox search java sapmchn
139142
```
140143

141144
## Semeru (IBM)
142145
Semeru Runtimes use the class libraries from OpenJDK, along with the Eclipse OpenJ9 Java Virtual Machine to enable developers to build and deploy Java applications that will start quickly, deliver great performance, all while using less memory.
143146

144147
```shell
145-
$ vfox install java x.y.z-sem
148+
$ vfox install java@x.y.z-sem
146149
$ vfox search java sem
147150
```
148151

149152
## Temurin (Eclipse)
150153
Formerly AdoptOpenJDK, the Eclipse Adoptium Temurin™ project provides code and processes that support the building of runtime binaries and associated technologies that are high performance, enterprise-caliber, cross-platform, open-source licensed, and Java SE TCK-tested for general use across the Java ecosystem.
151154

152155
```shell
153-
$ vfox install java x.y.z-tem
156+
$ vfox install java@x.y.z-tem
154157
$ vfox search java tem
155158
```
156159

157160
## Trava (Trava)
158161
TravaOpenJDK is OpenJDK for developers. It is based on dcevm and uses an integrated HotswapAgent, so allowing advanced hotswapping of classes by method and field addition or updates at runtime.
159162

160163
```shell
161-
$ vfox install java x.y.z-trava
164+
$ vfox install java@x.y.z-trava
162165
$ vfox search java trava
163166
```
164167

165168
## Zulu (Azul Systems)
166169
Azul Zulu Builds of OpenJDK are no-cost, production-ready open-source, TCK-tested, and certified OpenJDK distributions. They are available for a wide range of hardware platforms and operating systems and are compatible with special requirements, such as stripped-down JREs and builds, including OpenJFX and Coordinated Restore at Checkpoint (CRaC). They are supported as part of Azul Platform Core, which provides stabilized security updates for rapid, assured deployment into production and solution-oriented engineering assistance.
167170

168171
```shell
169-
$ vfox install java x.y.z-zulu
172+
$ vfox install java@x.y.z-zulu
170173
$ vfox search java zulu
171174
```
172175

173176
## Jetbrains
174177

175178
```shell
176-
$ vfox install java x.y.z-jb
179+
$ vfox install java@x.y.z-jb
177180
$ vfox search java jb
178181
```
179182

hooks/pre_install.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ function PLUGIN:PreInstall(ctx)
1414
error("Could not extract a valid distribution: " .. ctx.version)
1515
end
1616
local jdks = foojay.fetchtJdkList(distribution_version.distribution.name, distribution_version.version)
17-
if not #jdks then
18-
return {}
17+
if not jdks or #jdks == 0 then
18+
error("No JDK found for " .. ctx.version .. " on " .. RUNTIME.osType .. "/" .. RUNTIME.archType .. ". Please check available versions with 'vfox search java'")
1919
end
2020
local jdk = jdks[1]
2121
local info = json.decode(httpGet(jdk.links.pkg_info_uri, "Failed to fetch jdk info")).result[1]

lib/foojay.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local json = require("json")
44
local foojay = {}
55

66
local URL =
7-
"https://api.foojay.io/disco/v3.0/packages/jdks?version=%s&distribution=%s&architecture=%s&archive_type=%s&operating_system=%s&lib_c_type=%s&release_status=ga&directly_downloadable=true&latest=available"
7+
"https://api.foojay.io/disco/v3.0/packages/jdks?version=%s&distribution=%s&architecture=%s&archive_type=%s&operating_system=%s&lib_c_type=%s&release_status=ga&directly_downloadable=true"
88

99
foojay.fetchtJdkList= function (distribution, version)
1010

@@ -27,6 +27,12 @@ foojay.fetchtJdkList= function (distribution, version)
2727
lib_c_type = "glibc"
2828
end
2929

30+
-- Convert arm64 to aarch64 for foojay API compatibility
31+
local arch = RUNTIME.archType
32+
if arch == "arm64" then
33+
arch = "aarch64"
34+
end
35+
3036
local reqUrl = URL:format(version, distribution, arch, archive_type, os, lib_c_type)
3137

3238
local resp, err = http.get({

0 commit comments

Comments
 (0)