Skip to content

Fixed JDK Downloader windows ARM64 download issue #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vscode/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const ORACLE_JDK_BASE_DOWNLOAD_URL = `https://download.oracle.com/java`;
export const ORACLE_JDK_DOWNLOAD_VERSIONS = ['23','21'];

export const OPEN_JDK_VERSION_DOWNLOAD_LINKS: { [key: string]: string } = {
"23": "https://download.java.net/java/GA/jdk23/3c5b90190c68498b986a97f276efd28a/37/GPL/openjdk-23"
"23": "https://download.java.net/java/GA/jdk23.0.1/c28985cbf10d4e648e4004050f8781aa/11/GPL/openjdk-23.0.1"
};

export const ORACLE_VSCODE_EXTENSION_ID = 'oracle.oracle-java';
Expand Down
30 changes: 28 additions & 2 deletions vscode/src/jdkDownloader/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,12 @@ export class JdkDownloaderView {
}

private getMachineArchHtml = () => {
return `<option value="aarch64" ${this.machineArch === 'aarch64' ? 'selected' : null}>arm64</option>
<option value="x64" ${this.machineArch === 'x64' ? 'selected' : null}>x64</option>`
if (this.osType === 'windows') {
return `<option value="x64" selected>x64</option>`;
} else {
return `<option value="aarch64" ${this.machineArch === 'aarch64' ? 'selected' : null}>arm64</option>
<option value="x64" ${this.machineArch === 'x64' ? 'selected' : null}>x64</option>`;
}
}

private getScriptJs = () => {
Expand Down Expand Up @@ -234,6 +238,28 @@ export class JdkDownloaderView {
triggerJDKDownload(event);
});

document.getElementById("oracleJDKOsTypeDropdown")?.addEventListener('change', (event) => {
updateMachineArchOptions(event.target.id);
});

document.getElementById("openJDKOsTypeDropdown")?.addEventListener('change', (event) => {
updateMachineArchOptions(event.target.id);
});

const updateMachineArchOptions = (osDropdownId) => {
const osDropdown = document.getElementById(osDropdownId);
const machineArchDropdown = document.getElementById(osDropdownId.replace('OsTypeDropdown', 'MachineArchDropdown'));

if (osDropdown.value === 'windows') {
machineArchDropdown.innerHTML = '<option value="x64" selected>x64</option>';
} else {
machineArchDropdown.innerHTML = \`
<option value="aarch64" \${machineArchDropdown.value === 'aarch64' ? 'selected' : null}>arm64</option>
<option value="x64" \${machineArchDropdown.value === 'x64' ? 'selected' : null}>x64</option>
\`;
}
};

const hideOrDisplayDivs = (e) => {
const { id } = e.target;
if(activeButton){
Expand Down