Is there's any java embedded web browser(free) that support applet running ?
I don't mind if its use some native libraries.
Currently ,I already tried javafx web view and DJnativeswing and they dont detect java(doesn't support applet).
Most of the modern browsers (Chrome v42+, Firefox 64 for Windows, Microsoft Edge, etc) have dropped support for NPAPI which is required for applets to run. Oracle is recommending that developers switch over to Java Web Start instead of using applet as the technology is fading. If you still need to use applets (eg. for school programming projects) you may need to uninstall your current browser(s) and install a legacy browser that still includes NPAPI.
Browser do not support applets nativly. That's because applets need a java runtime environment and an browser adapter to display the content in the browser. But if you install a jre it always will install an plugin into you browser(s) if not already present.
Related
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
Is it still possible to start a 'native' application under windows via a java applet in a browser? IE "Click here to start notepad.exe" on a web page. The most recent reference I could find for this was dated 2002. Im wondering if this model / concept is no longer supported.
Yes, but the applet has to be signed.
Signed applets will prompt the user to give them permission. Once given, the applet has the same rights as any application running on the machine, including the ability to launch native apps (or link native libraries, which I've had to do in the past).
..Is it still possible to start a 'native' application under windows via a java applet in a browser?
Sure thing. As mentioned in other replies, a signed (and trusted) applet can use Runtime.exec(String) to launch a native application.
As of Java 1.6, it becomes simpler with the implementation of Dekstop.getDesktop.open(File), which will open the selected File with whatever application the OS has registered as a consumer for that file type.
As of Sun's Plugin2 architecture (1.6.0_10+ in a Sun/Oracle JRE) offers a more generic method for an (sand-boxed) applet embedded in a web page, using the JNLP API's BasicService. Here is my demo. of the BasicService
The portable way of doing this is to create a signed Applet.
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?
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.
JXBrowser is one option. It's including Safari.
WebKit 4 SWT is close to what you need but only work on Windows for now.
What is the canonical way to include the Applet?
I have tried,
Switch on Browsers in JS.
http://download.oracle.com/javase/1.5.0/docs/guide/plugin/developer_guide/using_tags.html#javascript
This breaks in Safari 5.0.1 on Leopard. (It worked on Safari on Snow leopard.)
Since we are not supporting old brosers, I assumed I could just use <object> tag, but apparently FF wont respect that.
What is the canonical way to do this?
The applet tag seems like a reasonable compromise, but I've migrated almost entirely to Java Web Start.
Addendum: A passerby notes,
JWS is a technology for launching desktop apps.
From the Java SE 6u10 release notes: "The next-generation Java Plug-In technology…provides support for launching applets directly from JNLP files."
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.