Skip to content

Commit e67bf39

Browse files
authored
Merge pull request #5 from PixelmonPRO/develop
chore: release v1.1.2
2 parents 6af64fe + f8161a8 commit e67bf39

8 files changed

Lines changed: 495 additions & 96 deletions

File tree

LICENSE

Lines changed: 380 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![Java Version Manager Logo](docs/images/banner.gif)
2+
13
# Java Version Manager [set-java]
24

35
![License: CC BY-NC 4.0](https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg)
@@ -6,101 +8,105 @@
68

79
---
810

9-
### 🇷🇺 Русский
10-
11-
**Java Version Manager** — это мощный PowerShell-скрипт для Windows, который упрощает поиск, установку, переключение и управление несколькими версиями JDK/JRE от разных поставщиков.
12-
13-
#### ✨ Ключевые возможности
14-
15-
* **Мульти-провайдер:** Поддержка Azul Zulu, Adoptium Temurin, Amazon Corretto, BellSoft Liberica, 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 / другие).**
11+
### 🇺🇸 English
12+
**Java Version Manager** is a powerful PowerShell script for Windows that simplifies finding, installing, switching, and managing multiple JDK/JRE versions from various providers.
3013

31-
После этого вам будут доступны команды `set-java`, `javas` или `jav` из любой точки системы.
14+
#### ✨ Key Features
3215

33-
#### 🎮 Использование
16+
* **Multi-Provider Support:** Works with Azul Zulu, Adoptium Temurin, Amazon Corretto, BellSoft Liberica, Oracle GraalVM, and more.
17+
* **Installation:** Find and install the required Java version in just a few clicks.
18+
* **Version Switching:** Instantly switch the active `JAVA_HOME` for the current session or the entire system.
19+
* **Updates:** Automatically find and install minor updates for your installed JDKs.
20+
* **Cleanup:** Uninstall old versions with smart `Path` variable cleaning.
21+
* **IDE Integration:** Synchronize installed JDKs with your IntelliJ IDEA configuration and remove orphaned entries.
22+
* **Security:** Verifies the integrity of downloaded archives using SHA256 checksums.
23+
24+
#### 🚀 Installation (Step-by-Step)
25+
1. **Download:** Go to the [Releases](https://github.com/PixelmonPRO/Java-Version-Manager/releases) page (on the right side of the repository) and download the latest `java-manager.zip` file.
26+
2. **Unzip:** Locate the downloaded zip file, right-click it, and select **"Extract All..."**. Extract it to any folder (e.g., your Desktop or Downloads).
27+
* *Important: Do not run files directly from inside the zip archive without extracting them first.*
28+
3. **Run Setup:** Open the extracted folder. Find the `setup.bat` file. Right-click it and select **"Run as administrator"**.
29+
* *Why Admin?* The script needs permission to copy files to `Program Files` and update your system `Path` variable so you can use the command from anywhere.
30+
* *SmartScreen Warning:* If Windows prevents the startup, click **"More info"** and then **"Run anyway"**.
31+
4. **Finish:** The script will automatically install the tool to `C:\Program Files\Java\scripts`.
32+
5. **Restart:** Close **ALL** currently open terminal windows (Command Prompt, PowerShell, Windows Terminal, IDEs). Open a new terminal to apply changes.
33+
34+
After this, the `set-java`, `javas`, or `jav` commands will be available system-wide.
3435

35-
**Интерактивный режим (меню):**
36-
```
36+
#### 🎮 Usage
37+
**Interactive Mode (Menu):**
38+
Simply type this command in your terminal:
39+
```powershell
3740
set-java
3841
```
3942

40-
**Неинтерактивный режим (примеры):**
41-
```
42-
# Показать доступные для установки версии Java 21 от Adoptium
43+
**Non-Interactive Mode (Examples):**
44+
```powershell
45+
# List available Java 21 versions from Adoptium
4346
set-java --list 21 --provider "Eclipse Adoptium (Temurin)"
4447
45-
# Установить последнюю версию Java 17 от Azul Zulu и сделать ее системной
48+
# Install the latest Java 17 from Azul Zulu and set it as the system default
4649
set-java --install 17 --provider "Azul Zulu" --permanent
4750
48-
# Переключить активную версию на уже установленную
51+
# Switch the active version to an already installed one
4952
set-java --switch "zulu21.32.17-ca-fx-jdk21.0.2-win_x64"
5053
51-
# Обновить все установленные JDK до последних минорных версий
54+
# Update all installed JDKs to their latest minor versions
5255
set-java --update --force
5356
54-
# Синхронизировать JDK в IntelliJ IDEA
57+
# Synchronize JDKs with IntelliJ IDEA
5558
set-java --clean-ide --force
5659
```
57-
---
58-
59-
### 🇺🇸 English
6060

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
61+
---
6462

65-
* **Multi-Provider Support:** Works with Azul Zulu, Adoptium Temurin, Amazon Corretto, BellSoft Liberica, 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.
63+
### 🇷🇺 Русский
7264

73-
#### 🚀 Installation
65+
**Java Version Manager** — это мощный PowerShell-скрипт для Windows, который упрощает поиск, установку, переключение и управление несколькими версиями JDK/JRE от разных поставщиков.
7466

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).**
67+
#### ✨ Ключевые возможности
68+
* **Мульти-провайдер:** Поддержка Azul Zulu, Adoptium Temurin, Amazon Corretto, BellSoft Liberica, Oracle GraalVM и других.
69+
* **Установка:** Поиск и установка нужной версии Java в несколько кликов.
70+
* **Переключение:** Мгновенное переключение активной версии `JAVA_HOME` для сессии или для всей системы.
71+
* **Обновление:** Автоматический поиск и установка минорных обновлений для установленных JDK.
72+
* **Очистка:** Удаление старых версий и "умная" очистка переменной `Path`.
73+
* **Интеграция с IDE:** Синхронизация установленных JDK с конфигурацией IntelliJ IDEA, удаление "осиротевших" записей.
74+
* **Безопасность:** Проверка целостности скачиваемых архивов по контрольной сумме SHA256.
75+
76+
#### 🚀 Подробная установка
77+
1. **Скачивание:** Перейдите на страницу [Releases](https://github.com/PixelmonPRO/Java-Version-Manager/releases) (раздел "Releases" справа на странице) и скачайте последний файл `java-manager.zip`.
78+
2. **Распаковка:** Найдите скачанный архив, нажмите на него правой кнопкой мыши и выберите **"Извлечь все..."**. Распакуйте файлы в любую удобную папку (например, на Рабочий стол).
79+
* *Важно: Не запускайте файлы прямо из архива, сначала обязательно распакуйте их.*
80+
3. **Запуск установки:** Откройте папку с распакованными файлами. Найдите файл `setup.bat`. Нажмите на него правой кнопкой мыши и выберите **"Запуск от имени администратора"**.
81+
* *Зачем права админа?* Скрипт копирует файлы в `Program Files` и прописывает путь к программе в систему, чтобы команда работала везде.
82+
* *SmartScreen:* Если Windows покажет синее окно "Система защитила ваш компьютер", нажмите **"Подробнее"**, а затем **"Выполнить в любом случае"**.
83+
4. **Завершение:** Скрипт скопирует все необходимые файлы в `C:\Program Files\Java\scripts`.
84+
5. **Перезапуск:** Закройте **ВСЕ** открытые окна терминалов (CMD, PowerShell, IDE). Откройте новый терминал, чтобы изменения вступили в силу.
8085

81-
After this, the `set-java`, `javas`, and `jav` commands will be available system-wide.
86+
После этого вам будут доступны команды `set-java`, `javas` или `jav` из любой точки системы.
8287

83-
#### 🎮 Usage
88+
#### 🎮 Использование
89+
**Интерактивный режим (меню):**
90+
Просто введите команду в терминале:
8491

85-
**Interactive Mode (Menu):**
86-
```
92+
```powershell
8793
set-java
8894
```
8995

90-
**Non-Interactive Mode (Examples):**
91-
```
92-
# List available Java 21 versions from Adoptium
96+
**Неинтерактивный режим (примеры):**
97+
```powershell
98+
# Показать доступные для установки версии Java 21 от Adoptium
9399
set-java --list 21 --provider "Eclipse Adoptium (Temurin)"
94100
95-
# Install the latest Java 17 from Azul Zulu and set it as the system default
101+
# Установить последнюю версию Java 17 от Azul Zulu и сделать ее системной
96102
set-java --install 17 --provider "Azul Zulu" --permanent
97103
98-
# Switch the active version to an already installed one
104+
# Переключить активную версию на уже установленную
99105
set-java --switch "zulu21.32.17-ca-fx-jdk21.0.2-win_x64"
100106
101-
# Update all installed JDKs to their latest minor versions
107+
# Обновить все установленные JDK до последних минорных версий
102108
set-java --update --force
103109
104-
# Synchronize JDKs with IntelliJ IDEA
110+
# Синхронизировать JDK в IntelliJ IDEA
105111
set-java --clean-ide --force
106112
```

docs/images/banner.gif

30.2 MB
Loading

docs/images/banner.png

4.23 MB
Loading

src/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"scriptVersion": "1.1.1",
2+
"scriptVersion": "1.1.2",
33
"language": "ru-RU",
44
"javaInstallPath": "C:\\Program Files\\Java",
55
"displayLimit": 20,

src/set-java.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
.\set-java.ps1 --clean-ide --force
1919
#>
2020

21+
# Принудительная установка кодировки консоли на UTF-8 для корректной работы с кириллицей
22+
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
23+
[Console]::InputEncoding = [System.Text.Encoding]::UTF8
24+
2125
# --- Параметры командной строки ---
2226
param(
2327
[string]$List,
@@ -65,7 +69,7 @@ function Initialize-Configuration {
6569
} catch { throw "Failed to create config.json at '$configPath'. Check permissions." }
6670
}
6771
try {
68-
$script:config = Get-Content -Path $configPath -Raw | ConvertFrom-Json -ErrorAction Stop
72+
$script:config = Get-Content -LiteralPath $configPath -Raw -Encoding UTF8 | ConvertFrom-Json -ErrorAction Stop
6973
} catch { throw "Failed to read or parse config.json. Please ensure it is a valid JSON file." }
7074

7175
$script:javaInstallPath = [System.Environment]::ExpandEnvironmentVariables($config.javaInstallPath)
@@ -80,7 +84,7 @@ function Initialize-Configuration {
8084
}
8185

8286
try {
83-
$script:L = Get-Content -Path $langFilePath -Raw -Encoding UTF8 | ConvertFrom-Json
87+
$script:L = Get-Content -LiteralPath $langFilePath -Raw -Encoding UTF8 | ConvertFrom-Json
8488
} catch { throw "Failed to parse language file '$langFilePath'." }
8589
}
8690

@@ -846,7 +850,7 @@ function Find-AvailableUpdates {
846850

847851
if (Test-Path $metaPath) {
848852
# НОВАЯ ЛОГИКА: Читаем метаданные
849-
$meta = Get-Content -Path $metaPath -Raw | ConvertFrom-Json
853+
$meta = Get-Content -LiteralPath $metaPath -Raw | ConvertFrom-Json
850854
$provider = $config.providers | Where-Object { $_.name -eq $meta.providerName }
851855
$majorVersion = $meta.majorVersion
852856
$packageType = $meta.packageType
@@ -897,7 +901,7 @@ function Perform-Update {
897901
$oldMetaPath = Join-Path $OldJdk.Path ".jvm_meta.json"
898902
$pkgTypeForNew = 'jdk' # По умолчанию
899903
if (Test-Path $oldMetaPath) {
900-
$oldMeta = Get-Content $oldMetaPath -Raw | ConvertFrom-Json
904+
$oldMeta = Get-Content -LiteralPath $oldMetaPath -Raw | ConvertFrom-Json
901905
$pkgTypeForNew = $oldMeta.packageType
902906
} else {
903907
# Легаси-проверка для старых установок
@@ -1036,7 +1040,7 @@ function Invoke-IdeCleanup {
10361040
Write-Host ($L.CleanIdeConfigFileFound -f $file)
10371041

10381042
try {
1039-
[xml]$xml = Get-Content -Path $file -Raw -Encoding UTF8
1043+
[xml]$xml = Get-Content -LiteralPath $file -Raw -Encoding UTF8
10401044
} catch {
10411045
Write-Warning "Не удалось прочитать XML-файл '$file'. Пропуск. Ошибка: $($_.Exception.Message)"
10421046
continue

0 commit comments

Comments
 (0)