Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Desktop app with webview UI

I want some way of creating a dedicated browser window for a browser (chrom-e/ium or firefox). Its content needs to be controlled by a java application (a http call to localhost or better a more direct way of communicating). These two should be bundled together in some way.

A little Background

I want to write a java desktop app but don't want to use Swing or javaFX for the UI. The UI should be written like a one page app and may be ported (at least partially) to the web. I have taken a look at the javafx WebView but would rather have a full fledged browser on my hands. It would also be nice to have a little more control over said browser to send files and read files in a more desktopish way. The only real requirement is that there has to be some java backend behind it and that is has to work offline.

Is something like this possible at all or is it just a pipe dream?

like image 510
Blank Chisui Avatar asked Dec 07 '15 00:12

Blank Chisui


2 Answers

I am very almost a year late for the party, but:

There are a few (that I know) technologies that can help you:

  1. Electron. It is basically what you want, you can use web technologies to "forge" a desktop app, it's quite well known, I never used it but for what I have read that you can stick almost anything to it's "backend".

  2. JavaFxWebView. There are some really nice ways to use it, you can even use bootstrap and AngularJs, here is a example (not by me)

like image 136
LouizFC Avatar answered Oct 27 '22 00:10

LouizFC


Yes it's possible and not all that unusual. Your app can open a default browser as described here -

https://stackoverflow.com/a/10967469/5087125

And then proceed to respond to http requests to your app.

like image 30
pvg Avatar answered Oct 27 '22 01:10

pvg