System Requirements
Before installing the application, ensure your system meets the following requirements:Java 21
Java Development Kit (JDK) version 21 or higher
Apache Maven
Maven 3.6 or higher for building the project
Operating System
Windows, macOS, or Linux
Memory
Minimum 512 MB RAM (1 GB recommended)
Prerequisites
Install Java 21
The application requires Java 21 to run. Download and install the appropriate version for your operating system:
Install Apache Maven
Maven is required to build the project from source.
- Windows
- macOS
- Linux
- Download Maven from maven.apache.org
- Extract the archive to a directory (e.g.,
C:\Program Files\Apache\maven) - Add Maven’s
bindirectory to your system PATH - Verify installation:
Building the Application
Once you have all prerequisites installed, build the application using Maven:Clean and compile the project
Navigate to the project directory and run:This command:
- Cleans any previous build artifacts
- Compiles all Java source files in
src/main/java/ - Downloads required dependencies (SQLite JDBC, JCalendar)
Package the application
Create an executable JAR file with all dependencies included:This uses the Maven Shade plugin (configured in
pom.xml:69-89) to create a “fat JAR” containing:- All compiled classes
- SQLite JDBC driver (org.xerial:sqlite-jdbc:3.41.2.1)
- JCalendar library (com.toedter:jcalendar:1.4)
- Main class manifest entry pointing to
InventarioApp
The packaged JAR will be located at
target/Refactorizacion-ALFA-1.0-SNAPSHOT.jarDatabase Initialization
The application uses SQLite for data storage and automatically handles database setup:Automatic Setup Process
When you launch the application for the first time, theInventarioDAO class (model/InventarioDAO.java:46-66) automatically:
- Creates a
./dbdirectory in the application’s working directory - Initializes an SQLite database file:
./db/baseDeDatosInventario.db - Creates required tables via
crearBaseDeDatos()method (model/InventarioDAO.java:69-89):
Database Schema
productos table
productos table
Stores all medicine inventory items:
| Column | Type | Description |
|---|---|---|
id | INTEGER | Primary key, auto-increment |
nombre | TEXT | Medicine name |
existencias | INTEGER | Current stock quantity |
lote | TEXT | Batch/lot number |
caducidad | TEXT | Expiration date (format: yyyy-MM) |
fechaEntrada | TEXT | Date added to inventory |
fecha_separado | TEXT | Date reserved/separated (nullable) |
historial_ventas table
historial_ventas table
Records all sales transactions:
| Column | Type | Description |
|---|---|---|
id | INTEGER | Primary key, auto-increment |
idProducto | INTEGER | Foreign key to productos.id |
nombre | TEXT | Medicine name at time of sale |
cantidad | INTEGER | Quantity sold |
fechaVenta | TEXT | Sale date (ISO 8601 format) |
Running the Application
After building, you can run the application in two ways:InventarioApp.java:7-13:
On first launch, the application may display a caducity alert dialog if any medicines are near expiration (within 30 days) or already expired. This is normal behavior.
Troubleshooting
Java version error
Java version error
If you see an error like
UnsupportedClassVersionError or requires Java 21 or higher:- Verify your Java version:
java -version - Ensure you’re using JDK 21 (not an older version)
- Check your
JAVA_HOMEenvironment variable points to Java 21
Maven build fails
Maven build fails
If Maven cannot download dependencies:
- Check your internet connection
- Try clearing Maven’s local cache:
- Verify your Maven settings in
~/.m2/settings.xml
Database permissions error
Database permissions error
If the application cannot create the database:
- Ensure the application has write permissions in its directory
- Try running from a user-writable location (avoid system directories)
- Check disk space availability
Application won't start
Application won't start
If the window doesn’t appear:
- Check for errors in the terminal/console
- Verify the JAR was built correctly:
jar tf target/*.jar | grep InventarioApp.class - Ensure no other instance is running
- Try running with verbose output:
java -jar target/*.jar -verbose
Next Steps
Quickstart Guide
Learn how to use the application
Inventory Management
Explore inventory features