有没有办法在 Java 中嵌入浏览器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48249/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there a way to embed a browser in Java?
提问by Ande Turner
Is there a way to embed a browser in Java? more specifically, is there a library that can emulate a browser?
有没有办法在 Java 中嵌入浏览器?更具体地说,是否有可以模拟浏览器的库?
回答by Bart
You can try Webrendereror Ice Browser
你可以试试Webrenderer或Ice Browser
回答by Jimmy
I believe JWebPane is going to be the official way to embed a browser into a java app. Its based on the open sourced engine - WebKit, which is used in Apples Safari and Googles Chrome browsers.See this blogfor details.
我相信 JWebPane 将成为将浏览器嵌入 Java 应用程序的官方方式。它基于开源引擎 - WebKit,用于 Apples Safari 和 Googles Chrome 浏览器。有关详细信息,请参阅此博客。
回答by alexmcchessers
回答by Eddie
I have successfully opened a browser from Java using SWT. You can find code examplesof how to use SWT to open a Browser window. It's very easy to do.
回答by Uri
By far the most robust embeddable browser I am familiar with is the one in SWT. In fact, it is so flexible that the JavaDoc hover you can see in Eclipse is actually a browser, and the JavaDoc view actually supports things like animation!
迄今为止,我熟悉的最强大的可嵌入浏览器是 SWT 中的浏览器。事实上,它是如此灵活,以至于您在 Eclipse 中看到的 JavaDoc 悬停实际上是一个浏览器,而 JavaDoc 视图实际上支持动画之类的东西!
The only risk with using SWT is that there are different versions of the SWT library for different platforms. I'm not sure if there is a singl jar you could include to cover everyone.
使用 SWT 的唯一风险是针对不同平台有不同版本的 SWT 库。我不确定是否有一个单独的罐子可以包含在每个人身上。
回答by McDowell
You can embed a browser in a Swing/AWT GUI using the JDICAPI. I don't see any mention of OS X, so it may not be of use to you.
您可以使用JDICAPI在 Swing/AWT GUI 中嵌入浏览器。我没有看到任何提及 OS X 的内容,因此它可能对您没有用。
回答by l_39217_l
Take a look at https://xhtmlrenderer.dev.java.net/
回答by OscarRyz
You may try this: https://jdic.dev.java.net/
你可以试试这个:https: //jdic.dev.java.net/
(source: java.net)
(来源:java.net)
Or this: http://lobobrowser.org/java-browser.jsp
或者这个:http: //lobobrowser.org/java-browser.jsp
(source: lobobrowser.org)
(来源:lobobrowser.org)
回答by Horcrux7
If you need a pure Java solution then you can try JWebEngine. It render HTML 4 very good. You can use it in an applet, Java webstart and on any platform. The using is very simple.
如果您需要纯 Java 解决方案,那么您可以尝试JWebEngine。它呈现 HTML 4 非常好。您可以在小程序、Java webstart 和任何平台上使用它。使用非常简单。
回答by h3xStream
JxBrowserhas not been mentionned yet. It embed either Mozilla Firefox (Gecko), Apple Safari (WebKit) or Internet Explorer. Programmer's Guide
尚未提及 JxBrowser。它嵌入了 Mozilla Firefox (Gecko)、Apple Safari (WebKit) 或 Internet Explorer。程序员指南