Jlectron is a Java desktop application framework that combines Spring Boot, Angular, and JCEF (Java Chromium Embedded Framework) to create cross-platform, Electron-like applications using Java and web technologies. This repository contains a multi-module Maven project with frontend, backend, and packaging modules.
- Project Structure
- Modules
- Build and Packaging
- Running the Application
- Configuration Notes
- Developer Notes
jlectron/
├── frontend/ # Angular frontend
├── app/ # Spring Boot + JCEF backend
├── bundle/ # Packaging module with jpackage and JRE
├── pom.xml # Parent POM
- The project uses Maven multi-module layout.
- Java 21 is used for compilation and runtime.
- The
bundlemodule creates a native installer usingjpackageand bundles a JRE and JCEF.
- Path:
frontend/ - Purpose: Builds the Angular frontend application.
- Maven Plugin:
frontend-maven-plugin - Steps:
- Installs Node.js and npm locally.
- Runs
npm installto install dependencies. - Builds Angular app with
ng build. Output is placed indist/frontend/browser.
- Path:
app/ - Purpose: The Java backend that embeds the frontend and JCEF for rendering web content.
- Dependencies:
- Spring Boot (Web, Thymeleaf, DevTools, Configuration Processor)
- JCEF Maven wrapper (
jcefmaven)
- Build:
- Uses
maven-resources-pluginto copy Angulardistfolder totarget/classes/static. - Spring Boot Maven Plugin creates a fat JAR (
app.jar) including backend code and Angular frontend static files.
- Uses
- Notes:
- Angular build must exist before packaging
app.jar. - JCEF native libraries are loaded at runtime via
-Djava.library.path.
- Angular build must exist before packaging
- Path:
bundle/ - Purpose: Creates a native application package with JRE and JCEF.
- Steps:
- Copies
app.jarfromapp/target. - Copies JCEF folder into the bundle (
app/jcef). - Downloads and unpacks a JRE (Temurin 21) to bundle runtime.
- Uses
jpackage-maven-pluginto create a native launcher (Windows.exe) with proper JVM options:--enable-preview-Dfile.encoding=UTF-8-Djava.library.path=app/jcef/bin/lib/win64
- Copies
# Clean and build everything
mvn clean packageThis will execute modules in the following order:
frontend- builds Angular appapp- packages backend and copies frontend static filesbundle- packages native app with JRE and JCEF
app/target/app.jar– Spring Boot fat JAR with embedded Angular frontend.bundle/target/dist/– Native application image with bundled JRE and JCEF.
java -Djava.library.path=path/to/jcef/bin/lib/win64 -jar app/target/app.jar- Navigate to
bundle/target/dist/and runJlectron.exe. - JCEF native libraries and JRE are bundled, no external dependencies required.
- Angular build output folder: Configured in
app/pom.xmlasfrontend.build.dir. - JCEF path: Configured in
bundle/pom.xmlasjcef.dir. - JRE download URL: Configured in
bundle/pom.xmlasjre.download.link.windows. - Static files in JAR:
maven-resources-plugincopies frontend output intotarget/classes/staticbefore Spring Boot packaging. - JCEF library path: Must match your system architecture (Windows x64 in this configuration).
- Angular changes require rebuilding the frontend (
mvn -pl frontend clean packageorng buildmanually). - App module depends on frontend module; ensure frontend is built before packaging.
- Native packaging bundles its own JRE; Java installation on the target machine is not required.
- JVM options for enabling JCEF and encoding are set in
bundle/pom.xmlviajpackage-maven-plugin. - For debugging JCEF issues, run the fat JAR with
-Djava.library.pathpointing to the JCEF folder.
This project combines:
- Frontend: Angular application for UI.
- Backend: Spring Boot + JCEF to render frontend inside a desktop app.
- Packaging: Native Windows application with embedded JRE and Chromium engine.
- Multi-module Maven structure ensures build order and proper packaging of static resources and native libraries.
