Getting Chrome Browser in java Applications - java

Is there a way to get the Chrome browser inside of java applications similar to the way Awesomium works in C++ and C# applications?

There is currently no way getting the UI portion into a Java. You should consider just using barebone WebKit + V8 with many JNI calls. You could consider writing a JNA wrapper around those.
To make your JNA easier, you can wrap Chromium Embedded Framework

There's a Java Wrapper for the Chromium Embedded Framework (CEF).

Try javacef. This is open source project. This project can embed Chromium browser in Java SWT with multitab browser support, cookies manipulation, tab settings, printing, back, forward, refresh buttons and enhanced file download. This project is based on Chromium Embedded Framework (CEF).

Related

Chrome packaged app with a Java applet

Is it possible for a Chrome packaged app to contain a Java applet?
I'm attempting to integrate QZ-Print / jZebra into a packaged app, however the applet does not appear and JavaScript receives an error of applet / can't read method of undefined when attempting to call a function.
No, you cannot use any (NPAPI) plugin in a Chrome app.
The documentation lists several Disabled Web Features. Flash and Non-sandboxed plugins are both listed, so they cannot be embedded in a Chrome app. Flash -as a (sandboxed) PPAPI plugin- could be embedded inside a <webview> tag, but Java is a non-sandboxed NPAPI plugin, so it cannot be used in a <webview> tag.
And you cannot use Java applets within a legacy packaged app either, because Java does not support Chrome extensions. You might have more luck if you try to embed the Java applet from a http(s) site.
Note that both Java applets and legacy packaged apps are deprecated and going to be removed from Chrome in the future (announcement for Java plugins, announcement for packaged apps), so you should try to look for alternatives such as native messaging.
It will be an ad-hoc solution, but you can set "always allow" manually in chrome://plugins

Java Browser library

I need to implement a simple browser in java. I've been researching several possibilities including JxBrowser, JBrowser, JavaFX (WebEngine + WebView), among others. JxBrowser has potential but it's a paid library, which I would like to avoid.
This browser needs to be able to process all web functionalities including JavaScript and HTML5 while capable of connecting through proxies. Therefore the best solution may be to use a web engine like Gecko.
So I'd like some advice on libraries which are capable of implementing Gecko engine (including XULRunner) with the possibility of changing core Gecko preferences.
Also, if you know any other possible solution that doens't include Gecko, feel free to discuss.
Have you tried SWT Browser widget?
For proxy in SWT Browser, see How do I set a proxy for the Browser to use?,

Java integrated or embedded browser

I need a integrated or embedded java browser. I used WebEngine of javafx which support basic css as well html & java script but could not able to run flash file. Any way to do so.
Or any other Project u know which could fulfill my requirement.
You can also look at JxBrowser Java library that allows embedding Chromium-based web browser control into Java AWT/Swing application.
It supports both Java Swing and JavaFX.
BTW: the browser control is totally lightweight. All rendering happens in a separate native process by native Chromium engine. The web page looks like it's displayed in Google Chrome.
Check those (although they are not JavaFX but I suppose that they can be used):
http://lobobrowser.org/java-browser.jsp - pure Java
http://www.javadesktop.org/articles/jdic/index.html - better imho, but no longer maintained

Java and Silverlight together forever

I want to display a silverlight web page inside my java desktop application.
Does anyone know of a plugin or browser control that I can use to do this?
Embed an appropriate browser window into the Java app and it can load the SL - there will not be any interaction / communication between the two without some hacky code. Multiple browsers support SL but you are better off using the an IE based one at present, the chrome support is not official as I remember.
How about an iFrame? In the nutshell... Alternatively you can make a request to .Net app from within your java server code using something like HttpClient and then serve markup that way - would be relatively easy thing to do (relatively since if there authentication involved things can get complicated fast. And if you want (willing) to get "sophisticated" and you are using portlet technology there is WSRP
For the desktop app I would go with HttpClient suggestion: get the content, parse it then do with it what you please unless that Silverlite app is also running as webservice then you have some additional options by utilizing components that can consume services
Eclipse's SWT provides out of the box web browser component based on IE and/or Mozilla engine. For swing application you can use one of ActiveX bridges, such as J-Integra or JDIC or EZ JCOM.
Use JDIC WebBrowser component

Launching a URL in a Java Swing application

How do I launch a URL in the user's default browser, in code from a Java Swing application?
There is this Netbeans library, but the jar dont seem to contain the classes mentioned in the example.
And there seems to be a number of old bespoke examples around.
But are there any killer solutions?
If you're running on JDK 1.6, you java.awt.Desktop.
Desktop.getDesktop().browse(new java.net.URI("www.google.com"));
If running on an earlier JDK, I believe that you can download the JDIC library. Or hack something together by spawning processes.
To expand upon kdgregory's answer, the The Java Desktop API, available from Java 6, provides integration with the desktop with functionality such as launching default web browsers and mail clients.
Launching a web browser can be achieved by using the Desktop.browse method.
For example, launching http://stackoverflow.com can be acheived by the following:
Desktop.getDesktop().browse(new URI("http://stackoverflow.com"));
More information:
Using the Desktop API in Java SE 6
How to Integrate with the Desktop Class
You can look at BrowserLauncher, although the latest version of the JDK are trying to make that obsolete.

Categories

Resources