Git Product home page Git Product logo

maven-springboot-electron's Introduction

Maven + Springboot + Electron (+ OpenJDK)

This project is a starting point to wrap any Java web application (f.e. using Springboot) with electron as a native executable. For the build process, only maven is being used. This project contains all the necessary configuration and some placeholder files to get you started.

This project was inspired a lot by electron-java-app, but it has some key differences:

  • Instead of Gradle only Maven is being used (of course also Node but indirectly)
  • When building the Electron application an OpenJDK will be included to start the Java web application

Proof of concept

The purpose of this project was sole of personal interest to show that this concept (Electron -> shipped JDK -> Java Web Application as Jar) is possible. Before taking it into production, you should check your requirements carefully. On one hand, the project is in its current form far from ideal. Electron wastes out of the box a lot of resources on the client-side, shipping an additional a JVM and an embedded web server does not make it better (Why would I need a Browser and a OpenJDK just to use a Java Web application as a desktop application?). If it needs to be Java, why not use Swing or JavaFX? But I can imagine some use cases where this could come in handy, f.e. as inbetween solution before migrating to the cloud.
An improvement to the concept could be done by getting rid of the OpenJDK by using native images of the GraalVM. Getting rid of the browser is currently not possible. If PWAs get available for all platforms and can run applications running on localhost, the browser could eventually be dropped. Currently, an updater functionality is missing, also logging needs to be done manually.

How to build

mvn clean install -Pproduction

The artifacts from the electron build will be put into:

  • target\electron\springboot-on-electron-darwin-x64
  • target\electron\springboot-on-electron-win32-x64

When using Mac OS or linux, wine is required to build windows (check the maven build for further information).

When using Windows, admin privileges are required to build darwin (check the maven build for further information).

Shipping OpenJDK

Since not all your users have a JVM available via the classpath a OpenJDK 8 will be packed into the electron builds

Documentation

Build

When executing mvn clean install -Pproduction by default the windows (x64) and darwin (x64) will be built.

The rest is currently not supported but adding those shouldn't be too hard but some changes will need to be made at the following files:

Pull requests are welcome

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.