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?,
Related
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
I know this can be a bit of weird question, but let me explain the idea behind it first.
I have a win32 app exposed a an Activex host, this gives me the the following useful features:
Embed and call it from Internet Explorer as a simple to pass/return values from it using javascript.
Embed and call it from any win32 application made in languages like visual basic, c++, delphi etc. Even i can call it from MS office products like excel and word.
I have been asked to migrate this app to Java SWT but i donĀ“t know if it can be done without losing the mentioned capabilites, the only way could be to expose the app itself as an Activex host, can this be possible?.
Thanks a lot.
I have no experience with ActiveX, but a lot of examples are in snippets folder at SWT homepage. Try to check them..
If you migrate your app to Java SWT then you will lose the desired functionality of using in IE and as well as in other MS product based on COM or ActivX technology. Although one crude way could be to use some bi-directional COM broker like Jacob.
If given a choice then I will utilize the SWT's in-built support for COM and will try to embed your activex component in my swt application. For example, you can look at:
org.eclipse.swt.browser.IE -- Allows access to IE ActiveX component in the form SWT browser control.
org.eclipse.compare.internal.win32.WordComparison this is a part of eclipse's file diff plugin. The class is very nicely written and gives a COM flavored snippet of diffing two MS word files.
In this way I can have the activex intact for whatever purposes.
There is this article on adding activex support to swt without using any third party COM bridge
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).
I recently played around with the SWT browser widget (which is great). I am wondering if I could write a full desktop application with it (with java services behind - e.g. persistence) and what drawbacks I would have to consider. The advantage would be that people without java knowledge could work on the gui. Of course it depends on the requirements and I know that this is not a very specific question. But mabye someone already tried to build a bigger app this way and is willing to share insights.
Thanks
Marcel
I'm not sure I share your opinion of the SWT browser widget. AFAIK it's merely a shell into the default browser on your machine, merely with a few API access points. I've used it for minor things when I needed to show a web page from within the application. But writing a whole application? That doesn't make sense.
If you want to build a web-based application that runs in the browser against a Java based server framework, there are many AJAXian frameworks to do it. You'd still be doing JavaScript for your client code. And you'd still be dealing with all the complexities of different browsers. I'm not sure why you would want to host it inside an SWT application instead of just directly in the browser window.
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