Prerequisites
Before installing the Currency Converter, ensure you have the following:Java JDK
Java Development Kit 11 or higher
Git
Git for cloning the repository
The application requires Java 11+ because it uses modern features like
HttpClient, var, switch expressions with yield, and records.Verify Java Installation
Check your Java version:Installation Steps
Clone the Repository
Clone the Currency Converter repository to your local machine:
Replace
yourusername with the actual GitHub username or organization where the repository is hosted.Compile the Application
Compile the Java source files with the Gson dependency:This command:
-cp "lib/gson-2.10.1.jar"- Adds Gson library to the classpath-d out- Outputs compiled.classfiles to theoutdirectorysrc/lad/com/alura/conversormoneda/**/*.java- Compiles all Java files in the package
If you’re on Windows, use semicolons instead of colons in the classpath:
-cp "lib/gson-2.10.1.jar"Alternative: Using an IDE
You can also open the project in your favorite Java IDE:- IntelliJ IDEA
- Eclipse
- VS Code
- Open IntelliJ IDEA
- Select File > Open
- Navigate to the project directory and select it
- IntelliJ will automatically detect the
.imlfile - Right-click on
lib/gson-2.10.1.jarand select Add as Library - Run the application from
ConversorApp.java
Troubleshooting
ClassNotFoundException: com.google.gson
ClassNotFoundException: com.google.gson
This error means the Gson library is not in your classpath.Solution: Make sure to include
-cp "lib/gson-2.10.1.jar" when compiling and running:Error: release version 11 not supported
Error: release version 11 not supported
Your Java version is too old.Solution: Upgrade to Java 11 or higher. The application uses modern Java features like:
java.net.http.HttpClient(Java 11+)- Records (Java 14+, used in
RegistroConversion) - Switch expressions with
yield(Java 13+)
javac: file not found
javac: file not found
The path to source files is incorrect.Solution: Make sure you’re in the project root directory and the
src folder exists:Next Steps
Quick Start Guide
Learn how to run the application and perform your first currency conversion