6

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?

Blank Chisui
  • 1,043
  • 10
  • 25
  • This is just my opinion, but you seem to be crossing paradigms, "I want an web api which acts like a desktop api" or "I want a desktop app which acts like a web api". Pick one or the other based on your needs and requirements as to which one will fit the majority of your needs. A desktop app can interact with web services just fine and web apps (in particular with html5) can be very advanced. There are reasons for picking one over the other, you need to decide which way your requirements are weighted – MadProgrammer Dec 07 '15 at 00:34
  • It's more that I want to create a desktop app using web technologies, because the way they do UI is so much nicer. – Blank Chisui Dec 07 '15 at 00:50
  • @MadProgrammer there's plenty of software that's written exactly like that. For instance, management consoles for (non-consumer) networking gear where each piece of equipment doesn't come with the management interface built in. You run a java app that serves the UI to a local browser, the app in turn manages the equipment. Ends up being cross-platform with decent UI. – pvg Dec 07 '15 at 00:52
  • @Pvg Yes, but that runs within any browser, the OP seems to wanting to do a hibrid solution that would allow them to control the browser from a desktop app, but drive the app through the browser. And the last comment is opinion based, I know plenty of "web based apps" that look like complete crap, don't follow established user experience expectations for the platform that the user is using or simply make up there own (I also know plenty of desktop/native apps which do the same thing as well) – MadProgrammer Dec 07 '15 at 01:04
  • @BlankChisui Then just make a web app and run it through the standard available browsers. *"because the way they do UI is so much nicer"* is a matter of opinion, I've seen plenty of web apps which are, frankly, crap, either ignoring establish user experience paradigms or just making up there own because "they can". Focus on the users needs and expectations and no matter which direction you go in, you'll have a good application – MadProgrammer Dec 07 '15 at 01:06

2 Answers2

1

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.

Community
  • 1
  • 1
pvg
  • 2,673
  • 4
  • 17
  • 31
  • That's a cool feature I didn't know about. BUT users will only have IE9 due to some restrictions. I'd rather write a Swing app in that case. – Blank Chisui Dec 07 '15 at 00:53
  • So you want a full modern browser but your users don't have access to such a browser? I'm not sure Java (or anything short of installing a more recent browser) can fix that for you. – pvg Dec 07 '15 at 00:55
  • I was looking for something like mozillas [Prism](https://wiki.mozilla.org/Prism). And I know how far fetched this question is. – Blank Chisui Dec 07 '15 at 01:15
  • 2
    There are things like that, they typically don't integrate with Java, out the box. https://github.com/atom/electron and https://github.com/nwjs/nw.js/ come to mind. – pvg Dec 07 '15 at 01:19
  • nw.js looks is exactly what I was looking for. Thanks – Blank Chisui Dec 07 '15 at 16:41
1

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)

LouizFC
  • 161
  • 1
  • 10