10

I'm trying to embed a WebKit browser in my Java app. I insist on WebKit, because I don't want to test my HTML5/CSS/Javascript with every browser that, for instance, the Browser widget in the Eclipse SWT library supports.

Is there a way to do this on Mac, Windows and Linux, and thus make sure that my web pages are rendered inside my Java app uniformly?

Jean-Philippe Pellet
  • 59,296
  • 21
  • 173
  • 234
  • http://stackoverflow.com/questions/1454652/embed-browser-in-java-based-desktop-application http://stackoverflow.com/questions/48249/is-there-a-way-to-embed-a-browser-in-java http://stackoverflow.com/questions/943927/embed-a-web-browser-within-a-java-application are similar topics (not necessarily focusing on HTML5 and WebKit) – h3xStream Jul 31 '10 at 22:23

2 Answers2

6

Since SWT 3.7 M5, the Browser widget can use WebKit on all platforms if created with the SWT.WEBKIT flag. Platform-specific conditions may apply: see http://www.eclipse.org/swt/faq.php#howusewebkit.

Jean-Philippe Pellet
  • 59,296
  • 21
  • 173
  • 234
  • 2
    This is not a great option due to the requirements: Windows: 32-bit SWT, Safari must be installed Linux: WebKitGTK 1.2.0 or newer must be in the library load path. Examples of Linux distros that meet this requirement by default include Red Hat Enterprise Linux 6 and Ubuntu 10.04. OS X: No additional runtime requirements, the default renderer is WebKit-based. Windows requires safari to be installed? Not many people have this. – Joe Aug 16 '12 at 01:54
  • @Joe It's least impractical I found. Feel free to suggest other solutions. – Jean-Philippe Pellet Aug 16 '12 at 07:47
2

JXBrowser is one option. It's including Safari.

WebKit 4 SWT is close to what you need but only work on Windows for now.

h3xStream
  • 6,293
  • 2
  • 47
  • 57
  • 1
    JxBrowser is very expensive... and from their website I read "JxBrowser supports integration with Internet Explorer and Mozilla (corresponding FireFox 3) under Windows, Apple Safari and Mozilla under Mac OS X, and Mozilla under Linux". So no WebKit for all platforms. Maybe a façade for the SWT Browser widget using WebKit on Mac and Linux, and the WebKit4SWT widget you mention for Windows would be a solution. – Jean-Philippe Pellet Aug 02 '10 at 09:27
  • 3
    I used JxBrowser before and it's not truly cross platform and very slow to updates and lacks documentation. I forked out $2000 for it and overall experience was very bad as it's still buggy after two years and you must continue to pay license fee to get more updates.... – KJW May 07 '12 at 01:24
  • Can You give some example for webkit. – BasK Feb 11 '15 at 10:05
  • @BasK You can find up to date example on their website: http://www.teamdev.com/downloads/jxbrowser/docs/JxBrowser-PGuide.html#hello – h3xStream Feb 12 '15 at 21:37