1+ <div align =" center " >
2+ <img src =" assets/jenv-logo.png " width =" 200 " height =" 200 " alt =" JEnv Logo " >
3+
14# Jenv: Java Environment Manager
25
6+ ![ GitHub release] ( https://img.shields.io/github/v/release/WhyWhatHow/jenv )
7+ ![ Build Status] ( https://img.shields.io/github/actions/workflow/status/WhyWhatHow/jenv/release.yml?branch=main )
8+ </div >
39
10+ ## Overview
411
5- Jenv-Go is a command-line tool for managing multiple Java versions on your system. It allows you to easily switch between different Java versions, add new Java installations, and manage your Java environment.
12+ ` Jenv ` is a command-line tool for managing multiple Java versions on your system. It allows you to easily switch between
13+ different Java versions, add new Java installations, and manage your Java environment.
614
715## Features
816
9- - Add and manage multiple JDK installations
10- - Switch between Java versions with a single command
11- - Automatically update environment variables (JAVA_HOME, PATH)
12- - Cross-platform support (Windows, Linux)
13- - [x] ` Windows `
14- - [ ] ` Linux `
15- - [ ] ` MacOS `
17+ ### Efficient Java Version Management
18+
19+ - ** Symlink-Based Architecture**
20+ - Fast version switching through symbolic links
21+ - One-time system PATH configuration
22+ - Changes persist across system reboots
23+ - Instant effect in all console windows
24+
25+ ### Windows-First Design
26+
27+ - ** Optimized for Windows**
28+ - Automatic administrator privilege handling
29+ - Minimized UAC prompts with least privilege principle
30+ - Superior performance on Windows 10/11 systems
31+
32+ ### Modern CLI Experience
33+
34+ - ** User-Friendly Interface**
35+ - Intuitive command structure
36+ - Light/Dark theme support
37+ - Colorful output for improved readability
38+ - Detailed help documentation
39+
40+ ### Advanced Features
1641
42+ - ** Smart JDK Management**
43+ - System-wide JDK scanning
44+ - Alias-based JDK management
45+ - Current JDK status tracking
46+ - Easy JDK addition and removal
47+
48+ ### Future-Ready
49+
50+ - ** Cross-Platform Support (Planned)**
51+ - Windows support (Current)
52+ - Linux support (Coming soon)
53+ - macOS support (Coming soon)
1754## Project Structure
1855
1956```
@@ -35,28 +72,26 @@ Jenv-Go is a command-line tool for managing multiple Java versions on your syste
3572│ │ └── sys/ # System utilities
3673│ └── jenv.go # Main entry point
3774├── doc/ # Documentation
38- ├── templates/ # Template files
3975└── .github/ # GitHub configurations
4076 └── workflows/ # CI/CD workflows
4177```
4278
4379## Installation
4480
4581### From Release
46-
4782Download the latest release from the [ Releases page] ( https://github.com/WhyWhatHow/jenv/releases ) .
4883
4984### Build from Source
5085
5186#### Prerequisites
5287
53- - Go 1.16 or higher
88+ - Go 1.21 or higher
5489- Git
90+ - Windows systems require [ Administrator privileges] ( #symbolic-link-permissions ) (for creating system symbolic links)
5591
5692#### Build Steps
5793
58941 . Clone the repository:
59-
6095``` bash
6196git clone https://github.com/WhyWhatHow/jenv.git
6297cd jenv
@@ -68,71 +103,149 @@ cd jenv
68103
69104cd src
70105
71- go mod download
72106# For Windows (PowerShell)
73- go build -ldflags " -X github.com/whywhathow/jenv/cmd.Version=1.0.0" -o jenv.exe
107+ go build -ldflags " -X github.com/whywhathow/jenv/cmd.Version=1.0.0" -o jenv
74108
75109# For Linux/macOS
76110go build -ldflags " -X github.com/whywhathow/jenv/cmd.Version=1.0.0" -o jenv
77111
78112# For development build (with debug information)
79- go build -o jenv.exe
113+ go build -o jenv
80114```
81115
82116## Usage
83117
84- ### Basic Commands
118+ ![ jenv.gif] ( assets/jenv.gif )
119+
120+ ### Installation Verification
85121
86122``` bash
87- # Initialize or reinitialize jenv configuration
88- jenv init
123+ # Verify jenv installation
124+ jenv --version
125+
126+ ```
89127
128+ ### Add and remove JDK
129+
130+ ![ jenv-add.gif] ( assets/jenv-add.gif )
131+
132+ ``` bash
90133# Add a new JDK with an alias name
91134jenv add < alias> < jdk_path>
92135jenv add jdk8 " C:\Program Files\Java\jdk1.8.0_291"
136+ jenv remove < alias>
137+ jenv remove jdk8
138+ ```
139+
140+ ### List all installed JDKs
93141
94- # List all installed JDKs
142+ ``` bash
95143jenv list
144+ ```
145+
146+ ### Switch to a specific JDK version
96147
97- # Switch to a specific JDK version
148+ ``` bash
98149jenv use < alias>
99150jenv use jdk8
151+ ```
152+
153+ ### Remove a JDK from jenv
100154
101- # Remove a JDK from jenv
155+ ``` bash
102156jenv remove < alias>
103157jenv remove jdk8
104-
105- # Update environment variables (JAVA_HOME, PATH)
106- jenv update
107158```
108159
109- ### Additional Features
160+ ### Show current JDK in use
110161
111162``` bash
112- # Scan system for installed JDKs
163+ jenv current
164+ ```
165+
166+ ### Scan system for installed JDKs
167+ ``` bash
113168jenv scan c:\
169+ ```
114170
115- # Show current JDK in use
116- jenv current
171+ ### Add jenv to system PATH
117172
118- # Add jenv to system PATH
173+ ``` bash
119174jenv add-to-path
175+ ```
176+
177+ ### Change UI theme (light/dark)
120178
121- # Change UI theme (light/dark)
179+ ``` bash
122180jenv theme < theme_name>
123181jenv theme dark
124182```
125183
126- For detailed information about each command and its options, use:
184+ ### help & version
127185``` bash
128186jenv help [command]
187+ jenv --version
129188```
130189
190+ ## Q&A
191+
192+ ### Why are administrator privileges needed?
193+
194+ Due to Windows system restrictions, creating system-level symbolic links requires:
195+ ` Running PowerShell as Administrator `
196+
197+ ### Why was this project created?
198+
199+ While Linux and macOS users have mature tools like ` sdkman ` and ` jenv ` for Java version management, Windows users have
200+ limited options. The existing [ Jenv-forWindows] ( https://github.com/FelixSelter/JEnv-for-Windows ) solution, while
201+ functional, faces performance issues on Windows 10 systems.
202+
203+ This project was born out of two motivations:
204+
205+ 1 . To create a fast, efficient Java version manager specifically optimized for Windows
206+ 2 . To explore AI-assisted development using tools like ` cursor ` and ` Trae ` while learning Go programming from scratch
207+
208+ The goal is to provide Windows developers with a robust, performant solution for managing multiple Java environments,
209+ similar to what Linux and macOS users already enjoy.
210+
211+ ### How it works?
212+
213+ Inspired by nvm-windows, JEnv uses symlinks for Java version management, which offers several advantages:
214+
215+ 1 . ** Symlink-Based Architecture**
216+ - Creates a single symlink at ` C:\java\JAVA_HOME ` during installation
217+ - Switching Java versions only requires updating the symlink target
218+ - No need to modify system PATH repeatedly
219+ - Changes persist across system reboots and apply to all console windows
220+
221+ 2 . ** Implementation Details**
222+ - During initialization:
223+ - Creates ` JAVA_HOME ` directory at ` C:\java\JAVA_HOME `
224+ - Adds ` JAVA_HOME\bin ` to system PATH (one-time setup)
225+ - Creates initial symlink to default JDK
226+ - When switching versions:
227+ - Simply updates symlink target to desired JDK
228+ - No PATH modifications needed
229+ - Changes take effect immediately in all console windows
230+
231+ 3 . ** Administrative Privileges**
232+ - Administrator privileges are only required when creating/modifying symbolic links
233+ - UAC prompts are handled automatically with minimal privilege scope
234+ - Follows the principle of least privilege, requesting only necessary permissions
235+ - Permission requests only occur during initialization (jenv init) and version switching (jenv use)
236+
237+ This approach is more efficient than constantly modifying system PATH variables, providing a cleaner and more reliable
238+ solution for Java version management on Windows.
239+
131240## Acknowledgments
132241
133- Special thanks to [ Trae] ( https://trae.ai ) for providing the fantastic agentic IDE and AI Flow paradigm that greatly
134- enhanced our development experience.
242+ - [ cobra] ( https://github.com/spf13/cobra ) - A powerful CLI framework for Go
243+ - [ jreleaser] ( https://jreleaser.org/ ) - A release automation tool
244+ - [ nvm-windows] ( https://github.com/coreybutler/nvm-windows ) - Inspired our symlink-based approach
245+ - [ Jenv-for-Windows] ( https://github.com/FelixSelter/JEnv-for-Windows ) - A predecessor project for Java version
246+ management on Windows
135247
136248## License
137249
138250This project is licensed under the Apache License 2.0 - see the [ LICENSE] ( LICENSE ) file for details.
251+
0 commit comments