Rentamoto is a small Java desktop application for bike rentals. It uses a simple, non-Maven Java project layout located in the src/ directory and includes UI panels, services, and models.
src/- Java source codeMain.java- Application entry pointmodels/-Bike,Rental,Userdata classesservices/-BikeService,RentalService,UserServiceui/- Swing UI panels and frames (LoginFrame,Dashboard, etc.)utils/-DatabaseConnection,UIHelper
bin/- compiled classes (if using run.bat)run.bat- convenience batch script to compile/run on Windowslib/- external jars (if any)
- Windows (PowerShell recommended)
- Java 21 (LTS) or compatible JDK installed. Older JDKs may still work but Java 21 is recommended.
Open PowerShell in the project root (D:\Downloads\Rentamoto2\Rentamoto2) and run:
# compile all .java files into bin/ (create bin if missing)
mkdir bin; javac -d bin (Get-ChildItem -Path src -Recurse -Filter '*.java' | ForEach-Object { $_.FullName })
# run the application
java -cp bin MainOr use the provided run.bat (double-click or run in PowerShell):
.\run.bat- Download and install a Java 21 JDK (e.g., Temurin/Eclipse Adoptium or Oracle).
- Set
JAVA_HOMEand updatePATHtemporarily in PowerShell (session only):
$env:JAVA_HOME = 'C:\Program Files\Java\jdk-21'
$env:PATH = "$env:JAVA_HOME\bin;" + $env:PATH
java -versionFor a permanent change, update System Environment Variables via Windows Settings > Advanced system settings > Environment Variables.
- This project is a plain Java project (no Maven/Gradle). Upgrading to Java 21 typically requires:
- Installing a Java 21 JDK and pointing
JAVA_HOMEto it. - Recompiling sources with
javacfrom the Java 21 JDK. - Resolving any deprecated/removed APIs (rare for small Swing apps). Common places to check:
src/utils/DatabaseConnection.java— database driver compatibility and JDBC URL
- Installing a Java 21 JDK and pointing
- "Could not find or load main class Main" — ensure
javaccompiled classes intobinand thejava -cp bin Maincommand is run from project root. - Database connection issues — check
src/utils/DatabaseConnection.javafor JDBC URL and credentials. - Missing external JARs — place them in
lib/and add them to the classpath when compiling/running:
# include jars from lib
$libJars = -join ';', (Get-ChildItem lib -Filter '*.jar' | ForEach-Object { $_.FullName })
javac -cp $libJars -d bin (Get-ChildItem -Path src -Recurse -Filter '*.java' | ForEach-Object { $_.FullName })
java -cp "bin;$libJars" Main- Update
run.batto setJAVA_HOMEand classpath automatically for users if desired. - Add a
buildscript (Ant/Maven/Gradle) to simplify building and dependency management.
If you want, I can also:
- Create a
build.gradleorpom.xmlto manage the project and specify Java 21 compatibility. - Add CI workflow to compile/test the project with JDK 21.