Create a new folder/directory on your computer and save all three Java files:
C:\UserManagement\ (Windows)
or
/Users/YourName/UserManagement/ (Mac/Linux)
Save these files:
User.javaUserService.javaUserManagementSystem.java
Windows:
- Press
Win + R, typecmd, press Enter - Navigate to your folder:
cd C:\UserManagementMac/Linux:
- Open Terminal
- Navigate to your folder:
cd /Users/YourName/UserManagementCompile all Java files together:
javac User.java UserService.java UserManagementSystem.javaIf successful: No messages will appear (silent success)
If you get "javac not recognized":
- You need to install Java JDK first
- Download from: https://www.oracle.com/java/technologies/downloads/
java UserManagementSystem=====================================
USER & PROFILE MANAGEMENT SYSTEM
=====================================
=====================================
Status: Not Logged In
=====================================
1. Register New User
2. Login
3. Update My Profile
4. Search User Profile
5. View All Users
6. Logout
7. Exit
=====================================
Enter your choice:
- Open IntelliJ IDEA
- Create a new Java project
- Create a new package (e.g.,
com.usermanagement) - Create three Java classes with the exact names:
User.javaUserService.javaUserManagementSystem.java
- Copy the code into each file
- Right-click on
UserManagementSystem.java - Select Run 'UserManagementSystem.main()'
- Open Eclipse
- Create a new Java Project (File → New → Java Project)
- Create a new class for each file (Right-click src → New → Class)
- Paste the code into each class
- Run
UserManagementSystem.java(Right-click → Run As → Java Application)
- Install Java Extension Pack
- Create a new folder and open it in VS Code
- Create three
.javafiles - Click the "Run" button above the main method
- Or use terminal:
javac *.javathenjava UserManagementSystem
Enter your choice: 1
=== USER REGISTRATION ===
Enter Name (min 2 characters): John Doe
Enter Email (valid format): john@example.com
Enter Password (min 6 chars): password123
Enter Role (Admin/User/Guest): User
✓ User registered successfully!
Enter your choice: 2
=== USER LOGIN ===
Enter Email: john@example.com
Enter Password: password123
✓ Login successful! Welcome John Doe
Enter your choice: 3
=== UPDATE PROFILE ===
Current Information:
┌─────────────────────────┐
│ Name : John Doe
│ Email : john@example.com
│ Role : User
└─────────────────────────┘
What would you like to update?
1. Name
2. Password
3. Both
Enter choice (1-3): 1
Enter new Name (min 2 chars): John Smith
✓ Profile updated successfully!
Solution: Install Java JDK
- Download JDK from Oracle website
- Add Java to system PATH
Solution: Make sure you're in the correct directory
# Check if files exist
dir (Windows)
ls (Mac/Linux)Solution: Compile all files together
javac *.javaSolution: Run terminal as Administrator (Windows) or use sudo (Mac/Linux)
sudo java UserManagementSystem (Mac/Linux)After running the program, test these scenarios:
- Register → Choice 1 → Enter valid data
- Login → Choice 2 → Use registered credentials
- View All Users → Choice 5 → See all registered users
- Update Profile → Choice 3 → Change name or password
- Search User → Choice 4 → Search by email
- Logout → Choice 6 → Log out current user
- Exit → Choice 7 → Close program
The users.txt file will be created automatically in the same directory as your Java files. You can open it with any text editor to see the stored data:
John Doe|john@example.com|password123|User
Jane Smith|jane@example.com|mypass456|Admin
If you encounter any issues, check:
- Java version:
java -version - Compiler version:
javac -version - Current directory:
pwd(Mac/Linux) orcd(Windows) - File permissions: Make sure you can write to the directory
The program is ready to run! Let me know if you face any specific errors.