Skip to content

Commit 4a322c3

Browse files
authored
Merge pull request #1 from PixelmonPRO/develop
chore: Prepare for initial release v1.0.0
2 parents 506ec0e + da49937 commit 4a322c3

File tree

10 files changed

+1778
-2
lines changed

10 files changed

+1778
-2
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Create Release
2+
on:
3+
push:
4+
tags:
5+
- 'v*.*.*'
6+
7+
jobs:
8+
build:
9+
runs-on: windows-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v3
13+
14+
- name: Get version from tag
15+
run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $env:GITHUB_ENV
16+
17+
- name: Prepare files for release
18+
run: |
19+
mkdir release_package
20+
Copy-Item -Path "src\*" -Destination "release_package\src\" -Recurse
21+
Copy-Item -Path "src\setup.bat" -Destination "release_package\"
22+
Copy-Item -Path "README.md" -Destination "release_package\"
23+
24+
- name: Archive release files
25+
run: Compress-Archive -Path "release_package\*" -DestinationPath "java-manager-${{ env.RELEASE_VERSION }}.zip"
26+
27+
- name: Create Release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: ${{ github.ref }}
34+
release_name: Release ${{ github.ref }}
35+
draft: false
36+
prerelease: false
37+
38+
- name: Upload Release Asset
39+
uses: actions/upload-release-asset@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
with:
43+
upload_url: ${{ steps.create_release.outputs.upload_url }}
44+
asset_path: ./java-manager-${{ env.RELEASE_VERSION }}.zip
45+
asset_name: java-manager.zip
46+
asset_content_type: application/zip
47+

.gitignore

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# =================================================================================
2+
# Gradle
3+
# =================================================================================
4+
# Игнорируем кэши и артефакты сборки Gradle.
5+
.gradle/
6+
build/
7+
8+
# Не игнорируем сам Gradle Wrapper, он нужен для воспроизводимой сборки.
9+
!gradle/wrapper/gradle-wrapper.jar
10+
11+
12+
# =================================================================================
13+
# Приложение (SoundCloud Bot)
14+
# =================================================================================
15+
# Игнорируем файлы, которые генерирует сам бот во время работы.
16+
17+
# Лог-файлы (текстовые).
18+
*.log
19+
*.log.gz
20+
21+
# Отчеты и временные файлы из папки debug.
22+
/debug/
23+
/backup/
24+
/scripts/
25+
26+
# КРИТИЧЕСКИ ВАЖНО: Никогда не добавляйте .env файл в Git!
27+
# Он содержит ваши секретные ключи и токены.
28+
.env
29+
30+
31+
# =================================================================================
32+
# IDE (IntelliJ, Eclipse, VS Code и др.)
33+
# =================================================================================
34+
# Файлы, специфичные для сред разработки.
35+
36+
### IntelliJ IDEA ###
37+
.idea/
38+
*.iml
39+
*.iws
40+
out/
41+
42+
### Eclipse ###
43+
.apt_generated
44+
.classpath
45+
.factorypath
46+
.project
47+
.settings
48+
.springBeans
49+
.sts4-cache
50+
bin/
51+
52+
### NetBeans ###
53+
/nbproject/private/
54+
/nbbuild/
55+
/dist/
56+
/nbdist/
57+
/.nb-gradle/
58+
59+
### VS Code ###
60+
.vscode/
61+
62+
63+
# =================================================================================
64+
# Операционная система
65+
# =================================================================================
66+
# Системные файлы, которые могут случайно появиться в проекте.
67+
68+
### Mac OS ###
69+
.DS_Store
70+
71+
### Windows ###
72+
Thumbs.db

README.md

Lines changed: 106 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,106 @@
1-
# Java-Version-Manager
2-
🔥 Мощный PowerShell-скрипт для Windows, который упрощает поиск, установку, переключение и управление несколькими версиями JDK/JRE от разных поставщиков.
1+
# Java Version Manager [set-java]
2+
3+
![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)
4+
![PowerShell](https://img.shields.io/badge/PowerShell-5.1%2B-blue.svg)
5+
![OS](https://img.shields.io/badge/OS-Windows-blue.svg)
6+
7+
---
8+
9+
### 🇷🇺 Русский
10+
11+
**Java Version Manager** — это мощный PowerShell-скрипт для Windows, который упрощает поиск, установку, переключение и управление несколькими версиями JDK/JRE от разных поставщиков.
12+
13+
#### ✨ Ключевые возможности
14+
15+
* **Мульти-провайдер:** Поддержка Azul Zulu, Adoptium Temurin, Amazon Corretto, Oracle GraalVM и других.
16+
* **Установка:** Поиск и установка нужной версии Java в несколько кликов.
17+
* **Переключение:** Мгновенное переключение активной версии `JAVA_HOME` для сессии или для всей системы.
18+
* **Обновление:** Автоматический поиск и установка минорных обновлений для установленных JDK.
19+
* **Очистка:** Удаление старых версий и "умная" очистка переменной `Path`.
20+
* **Интеграция с IDE:** Синхронизация установленных JDK с конфигурацией IntelliJ IDEA, удаление "осиротевших" записей.
21+
* **Безопасность:** Проверка целостности скачиваемых архивов по контрольной сумме SHA256.
22+
23+
#### 🚀 Установка
24+
25+
1. Скачайте последний релиз со страницы [Releases](https://github.com/PixelmonPRO/Java-Version-Manager/releases).
26+
2. Распакуйте архив в любую временную папку.
27+
3. Щелкните правой кнопкой мыши по файлу `setup.bat` и выберите **"Запуск от имени администратора"**.
28+
4. Скрипт скопирует все необходимые файлы в `C:\Program Files\Java\scripts` и добавит эту папку в системный `Path`.
29+
5. **Перезапустите ваш терминал (CMD / PowerShell / другие).**
30+
31+
После этого вам будут доступны команды `set-java`, `javas` или `jav` из любой точки системы.
32+
33+
#### 🎮 Использование
34+
35+
**Интерактивный режим (меню):**
36+
```
37+
set-java
38+
```
39+
40+
**Неинтерактивный режим (примеры):**
41+
```
42+
# Показать доступные для установки версии Java 21 от Adoptium
43+
set-java --list 21 --provider "Eclipse Adoptium (Temurin)"
44+
45+
# Установить последнюю версию Java 17 от Azul Zulu и сделать ее системной
46+
set-java --install 17 --provider "Azul Zulu" --permanent
47+
48+
# Переключить активную версию на уже установленную
49+
set-java --switch "zulu21.32.17-ca-fx-jdk21.0.2-win_x64"
50+
51+
# Обновить все установленные JDK до последних минорных версий
52+
set-java --update --force
53+
54+
# Синхронизировать JDK в IntelliJ IDEA
55+
set-java --clean-ide --force
56+
```
57+
---
58+
59+
### 🇺🇸 English
60+
61+
**Java Version Manager** is a powerful PowerShell script for Windows that simplifies finding, installing, switching, and managing multiple JDK/JRE versions from various providers.
62+
63+
#### ✨ Key Features
64+
65+
* **Multi-Provider Support:** Works with Azul Zulu, Adoptium Temurin, Amazon Corretto, Oracle GraalVM, and more.
66+
* **Installation:** Find and install the required Java version in just a few clicks.
67+
* **Version Switching:** Instantly switch the active `JAVA_HOME` for the current session or the entire system.
68+
* **Updates:** Automatically find and install minor updates for your installed JDKs.
69+
* **Cleanup:** Uninstall old versions with smart `Path` variable cleaning.
70+
* **IDE Integration:** Synchronize installed JDKs with your IntelliJ IDEA configuration and remove orphaned entries.
71+
* **Security:** Verifies the integrity of downloaded archives using SHA256 checksums.
72+
73+
#### 🚀 Installation
74+
75+
1. Download the latest release from the [Releases](https://github.com/PixelmonPRO/Java-Version-Manager/releases) page.
76+
2. Unzip the archive to any temporary folder.
77+
3. Right-click on `setup.bat` and select **"Run as administrator"**.
78+
4. The script will copy all necessary files to `C:\Program Files\Java\scripts` and add this directory to the system `Path`.
79+
5. **Restart your terminal (CMD/PowerShell/etc).**
80+
81+
After this, the `set-java`, `javas`, and `jav` commands will be available system-wide.
82+
83+
#### 🎮 Usage
84+
85+
**Interactive Mode (Menu):**
86+
```
87+
set-java
88+
```
89+
90+
**Non-Interactive Mode (Examples):**
91+
```
92+
# List available Java 21 versions from Adoptium
93+
set-java --list 21 --provider "Eclipse Adoptium (Temurin)"
94+
95+
# Install the latest Java 17 from Azul Zulu and set it as the system default
96+
set-java --install 17 --provider "Azul Zulu" --permanent
97+
98+
# Switch the active version to an already installed one
99+
set-java --switch "zulu21.32.17-ca-fx-jdk21.0.2-win_x64"
100+
101+
# Update all installed JDKs to their latest minor versions
102+
set-java --update --force
103+
104+
# Synchronize JDKs with IntelliJ IDEA
105+
set-java --clean-ide --force
106+
```

src/config.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"scriptVersion": "1.0.0",
3+
"language": "ru-RU",
4+
"javaInstallPath": "C:\\Program Files\\Java",
5+
"displayLimit": 20,
6+
"providers": [
7+
{
8+
"name": "Azul Zulu",
9+
"apiType": "Azul",
10+
"apiUrl": "https://api.azul.com/metadata/v1/zulu/packages",
11+
"enabled": true,
12+
"namePrefix": "zulu"
13+
},
14+
{
15+
"name": "Eclipse Adoptium (Temurin)",
16+
"apiType": "Adoptium",
17+
"apiUrl": "https://api.adoptium.net/v3/assets/feature_releases/{java_version}/ga",
18+
"enabled": true,
19+
"namePrefix": "temurin"
20+
},
21+
{
22+
"name": "Amazon Corretto",
23+
"apiType": "Foojay",
24+
"apiUrl": "https://api.foojay.io/disco/v3.0/packages",
25+
"distributionName": "corretto",
26+
"enabled": true,
27+
"namePrefix": "amazon-corretto"
28+
},
29+
{
30+
"name": "Oracle GraalVM (for JDK 17+)",
31+
"apiType": "OracleDirectLink",
32+
"urlTemplate": "https://download.oracle.com/graalvm/{java_version}/latest/graalvm-jdk-{java_version}_windows-x64_bin.zip",
33+
"enabled": true,
34+
"namePrefix": "graalvm"
35+
},
36+
{
37+
"name": "GraalVM Community (Legacy)",
38+
"apiType": "GitHubReleases",
39+
"apiUrl": "https://api.github.com/repos/graalvm/graalvm-ce-builds/releases",
40+
"assetFilterPatterns": [
41+
"graalvm-ce-java{java_version}-windows-amd64*.zip",
42+
"graalvm-community-java{java_version}-windows-amd64*.zip",
43+
"graalvm-community-jdk-{java_version}_windows-x64_bin.zip"
44+
],
45+
"enabled": true,
46+
"namePrefix": "graalvm-ce"
47+
}
48+
]
49+
}

src/lang/en-US.json

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"MainMenuTitle": "--- Java Version Manager ---",
3+
"MainMenuInfo": "Installed versions: {0} | Install path: {1}",
4+
"CurrentJavaHome": "Current Active JAVA_HOME: {0}",
5+
"MenuSwitch": "1. Switch active JDK/JRE version",
6+
"MenuList": "2. List available JDKs/JREs for download",
7+
"MenuInstall": "3. Install a new JDK/JRE",
8+
"MenuUninstall": "4. Uninstall a local JDK/JRE",
9+
"MenuUpdate": "5. Update installed JDKs/JREs",
10+
"MenuQuit": "Q. Quit",
11+
"SelectOption": "Select an option:",
12+
"InvalidOption": "Invalid option. Please try again.",
13+
"PressEnter": "Press Enter to return to the main menu...",
14+
"PressEnterContinue": "Press Enter to continue...",
15+
"RequiresAdmin": "This operation requires Administrator privileges.",
16+
"Activating": "Activating: {0}",
17+
"SessionUpdated": "[Session] JAVA_HOME, JDK_HOME and Path have been updated.",
18+
"SystemUpdated": "[System] Environment variables have been updated permanently.",
19+
"SessionCleared": "[Session] Active JAVA_HOME was removed. Variables cleared.",
20+
"SystemCleared": "[System] Permanent JAVA_HOME was removed. Variables cleared.",
21+
"RestartTerminal": "You may need to restart your terminal for the changes to take full effect.",
22+
"Verification": "--- Verification ---",
23+
"InstallTitle": "--- Install a New JDK/JRE ---",
24+
"ListTitle": "--- List Available JDKs/JREs ---",
25+
"ChoosePackageType": "Choose package type [1] JDK (default), [2] JRE:",
26+
"IncludeFX": "Include JavaFX? [Y/n]:",
27+
"EnterMajorVersion": "Enter the major Java version (e.g., 21) or leave empty to browse all:",
28+
"NoJdksFound": "No builds found for Java version '{0}' with the specified criteria.",
29+
"EnterBuildToInstall": "Enter the number of the build to install (or press Enter to cancel):",
30+
"InstallationCancelled": "Installation cancelled.",
31+
"JdkAlreadyInstalled": "JDK/JRE '{0}' is already installed.",
32+
"Downloading": "Downloading {0}...",
33+
"FromUrl": "From URL: {0}",
34+
"DownloadFailed": "Download failed: {0}",
35+
"DownloadFileMissing": "Download failed: The file was not found at the destination after the transfer completed. Check permissions and disk space.",
36+
"VerifyingChecksum": "Verifying file integrity (SHA256)...",
37+
"ChecksumOK": "Checksum OK. File is valid.",
38+
"ChecksumMismatch": "CHECKSUM MISMATCH! The downloaded file is corrupt.\nExpected: {0}\nGot: {1}\nDeleting file.",
39+
"Extracting": "Extracting archive to '{0}'...",
40+
"InstallComplete": "Installation complete for '{0}'.",
41+
"SwitchTitle": "--- Switch Active JDK/JRE ---",
42+
"EnterJdkToActivate": "Enter the number of the JDK/JRE to activate:",
43+
"MakePermanent": "Make this change permanent for the system? (Requires Admin) [Y/n]:",
44+
"UninstallTitle": "--- Uninstall a Local JDK/JRE ---",
45+
"NoJdksToUninstall": "No JDK/JRE versions found to uninstall.",
46+
"EnterJdkToUninstall": "Enter the number of the JDK/JRE to uninstall (or press Enter to cancel):",
47+
"ConfirmDelete": "Are you sure you want to permanently delete '{0}'? [Y/n]:",
48+
"Deleting": "Deleting '{0}'...",
49+
"UninstallComplete": "Uninstallation complete.",
50+
"UninstallationCancelled": "Uninstallation cancelled.",
51+
"InvalidSelection": "Invalid selection.",
52+
"ApiQuery": "Querying {0} API for available packages...",
53+
"ApiFetchFail": "Failed to fetch data from API{0}. Check your internet connection. If the error persists (e.g., 404 Not Found), the API address may have changed.",
54+
"ApiUnexpectedError": "An unexpected error occurred while fetching data from the API. Check your internet connection or firewall settings.",
55+
"ApiRequiresVersion": "The {0} provider requires a major Java version to be specified for search.",
56+
"NoJdksInstalled": "No JDK/JRE versions found in '{0}'.",
57+
"DirNotFound": "Java installation directory not found: '{0}'. Create it? [Y/n]:",
58+
"DirCreateFailed": "Failed to create directory '{0}'.",
59+
"DirCreated": "Directory '{0}' created successfully.",
60+
"UpdateTitle": "--- Update Installed JDKs/JREs ---",
61+
"CheckingForUpdates": "Checking for available updates...",
62+
"NoUpdatesFound": "All installed JDKs/JREs are up-to-date. No updates required.",
63+
"UpdatesAvailable": "The following updates are available:",
64+
"EnterUpdateSelection": "Enter the numbers of the updates to install (comma-separated), 'a' for all, or Enter to cancel:",
65+
"UpdateCancelled": "Update cancelled.",
66+
"UpdatingJdk": "Updating {0} to {1}...",
67+
"UpdateComplete": "All selected packages have been updated successfully.",
68+
"StatusInstalled": "(Installed)",
69+
"AllBuildsInstalled": "\nAll available builds for Java {0} are already installed.",
70+
"SelectProviderTitle": "--- Select a JDK Provider ---",
71+
"SelectProviderPrompt": "Select a provider to search:",
72+
"AutoSelectingProvider": "Automatically selecting the only available provider: {0}",
73+
"FxNotSupportedWarning": "WARNING: The provider {0} does not support JavaFX-bundled builds. This flag will be ignored.",
74+
"JreNotSupportedWarning": "WARNING: The provider {0} only supplies JDKs. The 'JRE' package type will be ignored.",
75+
"NoProvidersEnabled": "No providers are enabled in config.json. Please enable at least one provider.",
76+
"NonInteractiveProviderRequired": "Non-interactive mode requires a provider to be specified with --provider \"Provider Name\".",
77+
"NonInteractiveProviderNotFound": "The specified provider '{0}' was not found or is not enabled in config.json.",
78+
"PathCleanupPrompt": "Detected obsolete Java entries in the system Path variable.",
79+
"PathCleanupInfo": "The following paths no longer exist and will be removed:",
80+
"ConfirmAction": "Perform action? [Y/n]:",
81+
"PathCleanupComplete": "Path variable cleanup complete.",
82+
"PathCleanupCancelled": "Path variable cleanup cancelled.",
83+
"NonInteractiveLatest": "Found {0} packages. Selecting the latest version: {1}",
84+
"NonInteractiveVersionNotFound": "Version '{0}' not found among installed JDKs.",
85+
"NonInteractiveSwitchingTo": "Switching to JDK/JRE: {0}",
86+
"NonInteractiveUninstallForce": "Use --force to confirm deletion of '{0}'.",
87+
"ConfirmUpdateAll": "Are you sure you want to install all found updates? [Y/n]:",
88+
"FileHashUnavailable": "Failed to calculate the file checksum after several retries. The file may be locked by an antivirus or corrupted.",
89+
"ProcessLockDetected": "Deletion failed. The following processes may be locking the files in '{0}':",
90+
"KillProcessesPrompt": "Do you want to attempt to terminate these processes and retry deletion? [Y/n]:",
91+
"TerminatingProcesses": "Attempting to terminate processes...",
92+
"TerminationFailed": "WARNING: Failed to terminate process {0} (PID: {1}).",
93+
"RetryingDelete": "Retrying deletion...",
94+
"DeletionFailedAgain": "Deletion failed again. Please close the locking applications manually and try again.",
95+
"NoProcessesFound": "Could not automatically identify locking processes. Please ensure any applications using this Java version (like IDEs or servers) are closed and try again.",
96+
"DebugHashFail": "failed, retrying in {0} sec...",
97+
"MenuCleanIde": "6. Synchronize IDE JDK configurations",
98+
"CleanIdeTitle": "--- Synchronize IDE JDK Configurations (IntelliJ IDEA) ---",
99+
"CleanIdeScanning": "Scanning for IntelliJ IDEA configuration files...",
100+
"CleanIdeConfigFileFound": "Found configuration file: {0}",
101+
"CleanIdeNoConfigsFound": "No IntelliJ IDEA configuration files found.",
102+
"CleanIdeNoOrphanedJdks": "No orphaned JDK entries found in IDE configurations. Cleanup is not required.",
103+
"CleanIdeOrphanedJdksFound": "The following orphaned JDK entries were found:",
104+
"CleanIdeWillBeRemoved": "Will be removed from:",
105+
"CleanIdeBackupCreated": "Backup created: {0}",
106+
"CleanIdeEntriesRemoved": "Entries removed successfully.",
107+
"CleanIdeComplete": "IDE configuration cleanup complete.",
108+
"CleanIdeDetectedJdksFound": "The following unregistered JDKs were found and will be added:",
109+
"CleanIdeEntriesUpdated": "IDE configuration entries updated successfully.",
110+
"CleanIdeNoChangesFound": "IDE configuration is up to date. No changes needed.",
111+
"CleanIdeRestartIde": "IMPORTANT: Please restart IntelliJ IDEA for the JDK configuration changes to take effect.",
112+
"UpdateAvailable": "A new script version is available ({0}). Current version: {1}.",
113+
"ConfirmScriptUpdate": "Do you want to download and install it now? [Y/n]:"
114+
}

0 commit comments

Comments
 (0)