Skip to main content
This guide walks you through installing all prerequisites and setting up the Veterinaria ALFA Inventory System on your machine.

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

1

Install Java 21

The application requires Java 21 to run. Download and install the appropriate version for your operating system:
  1. Download Java 21 from Oracle or Adoptium
  2. Run the installer and follow the installation wizard
  3. Verify installation by opening Command Prompt and running:
java -version
You should see output indicating Java version 21.x.x
2

Install Apache Maven

Maven is required to build the project from source.
  1. Download Maven from maven.apache.org
  2. Extract the archive to a directory (e.g., C:\Program Files\Apache\maven)
  3. Add Maven’s bin directory to your system PATH
  4. Verify installation:
mvn -version
3

Download the Source Code

Clone or download the project repository:
git clone https://github.com/your-org/Refactorizacion-ALFA.git
cd Refactorizacion-ALFA
If you don’t have Git installed, you can download the source code as a ZIP file from the repository and extract it.

Building the Application

Once you have all prerequisites installed, build the application using Maven:
1

Clean and compile the project

Navigate to the project directory and run:
mvn clean compile
This command:
  • Cleans any previous build artifacts
  • Compiles all Java source files in src/main/java/
  • Downloads required dependencies (SQLite JDBC, JCalendar)
2

Package the application

Create an executable JAR file with all dependencies included:
mvn package
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.jar
3

Verify the build

Check that the JAR file was created successfully:
ls -lh target/*.jar
You should see the shaded JAR file (typically larger due to included dependencies).

Database Initialization

The application uses SQLite for data storage and automatically handles database setup:
No manual database setup required! The application automatically creates the database on first run.

Automatic Setup Process

When you launch the application for the first time, the InventarioDAO class (model/InventarioDAO.java:46-66) automatically:
  1. Creates a ./db directory in the application’s working directory
  2. Initializes an SQLite database file: ./db/baseDeDatosInventario.db
  3. Creates required tables via crearBaseDeDatos() method (model/InventarioDAO.java:69-89):
// From InventarioDAO.java:71-78
CREATE TABLE IF NOT EXISTS productos (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    nombre TEXT,
    existencias INTEGER,
    lote TEXT,
    caducidad TEXT,
    fechaEntrada TEXT,
    fecha_separado TEXT
)
// From InventarioDAO.java:79-85
CREATE TABLE IF NOT EXISTS historial_ventas (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    idProducto INTEGER,
    nombre TEXT,
    cantidad INTEGER,
    fechaVenta TEXT,
    FOREIGN KEY (idProducto) REFERENCES productos(id) ON DELETE CASCADE
)

Database Schema

Stores all medicine inventory items:
ColumnTypeDescription
idINTEGERPrimary key, auto-increment
nombreTEXTMedicine name
existenciasINTEGERCurrent stock quantity
loteTEXTBatch/lot number
caducidadTEXTExpiration date (format: yyyy-MM)
fechaEntradaTEXTDate added to inventory
fecha_separadoTEXTDate reserved/separated (nullable)
Records all sales transactions:
ColumnTypeDescription
idINTEGERPrimary key, auto-increment
idProductoINTEGERForeign key to productos.id
nombreTEXTMedicine name at time of sale
cantidadINTEGERQuantity sold
fechaVentaTEXTSale date (ISO 8601 format)

Running the Application

After building, you can run the application in two ways:
mvn exec:java -Dexec.mainClass="InventarioApp"
The main application window will launch automatically. The entry point is in InventarioApp.java:7-13:
public static void main(String[] args) {
    SwingUtilities.invokeLater(() -> {
        InventarioDAO dao = new InventarioDAO();
        dao.crearBaseDeDatos(); // Creates tables if they don't exist
        InventarioController controller = new InventarioController(dao);
        new InventarioView(controller);
    });
}
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

If you see an error like UnsupportedClassVersionError or requires Java 21 or higher:
  1. Verify your Java version: java -version
  2. Ensure you’re using JDK 21 (not an older version)
  3. Check your JAVA_HOME environment variable points to Java 21
If Maven cannot download dependencies:
  1. Check your internet connection
  2. Try clearing Maven’s local cache:
    mvn clean -U
    
  3. Verify your Maven settings in ~/.m2/settings.xml
If the application cannot create the database:
  1. Ensure the application has write permissions in its directory
  2. Try running from a user-writable location (avoid system directories)
  3. Check disk space availability
If the window doesn’t appear:
  1. Check for errors in the terminal/console
  2. Verify the JAR was built correctly: jar tf target/*.jar | grep InventarioApp.class
  3. Ensure no other instance is running
  4. 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

Build docs developers (and LLMs) love