How To Make Electron App With Java Backend


#1

Hello everybody,

I’m new to electron.
I have my own Javafx desktop application working perfectly.
Now I want to make better gui design for my app which unfortunately javafx is not capable of.

So anybody can help me out with any idea how do i develop electron app which contain java as a controller backend ??

In my Java app, I have used “PRINTWRITER” class. So is there any possibility to access the same or similar class in electron ?

Thank you.


#2

Electron is designed to build native-looking applications using web technologies like HTML, CSS and JavaScript. There isn’t any way to make Electron use some other language like Java without Herculean effort.


#3

He can keep his backend in Java and create an API to communicate with his Electron application.

I don’t think he’s asking how to write an Electron app in Java.


#4

You can use that same class if it’s available to use via node-java.

That project is here: https://github.com/joeferner/node-java


#5

I’m skeptical that whatever it is you’re trying to do isn’t possible in JavaFX-or that a rewrite is the best mitigation path.

Your best bet if you do decide to throw away your entire front end is to write the Java side as an API.


#6

I think that’s can be done. Using node-java to communicate from electron to java, and using a local server to talk from java backend to electron. Or just use local server to implement both direction communication


#7

Anyone learned anything new about using Electron with a Java back-end?


#8

I’m new to Electron, but not new to javascript and java communications. I think it should be possible to connect to a hosted (locally or remotely) java server and connect to it with any Electron app. SpringBoot has all of this built in. You might be able to package the .jar in with your electron app and launch it from electron when it starts. I’m not sure about security, etc.


#9

Just tested this project that runs a Java/JVM application using Electron. Works for my case at least: https://github.com/jreznot/electron-java-app


#10

I’m the author of this repo and actually we use the same approach in our real-life applications. It was a PoC for our development tool that was a browser based application. We have just released electron based version of the tool and we are happy with the result. PM me if you are interested in links to the real life application based on this java+electron approach.


#11

Hi. First of all thanks for the repo. Can you kindly provide more details as I am interested in being able to use this? Thank you


#12

Next week, I’m going to publish complete tutorial on the approach here: https://github.com/cuba-labs/java-electron-tutorial So, if you need more detailed explanations, follow the link on next Monday.

The result of our research is the product of my company: https://www.cuba-platform.com/discuss/t/platform-cuba-studio-se-a-desktop-application-based-on-electron/2914?u=artamonov


#13

Thank you very much. At the moment I was using JavaFX webengine to load the html frontend, however looking into using electron, due to issues


#14

Draft of the tutorial has been published!


#15

Will have a look. Thanks for your help. Much appreciated