Reputation: 77
I have to run a Java applet from his jar in an Angular 10 application, I've tried to run on Chrome, IE11 and Edge but all my tries did not work.
I've done the following things:
<script language="Javascript">
var _app = navigator.appName;
if (_app == 'Mozilla') {
document.write('<embed code="MyClass.class"',
'width="200"',
'height="200"',
'type="application/x-java-applet;version=1.8.0">');
}
else if (_app == 'Microsoft Internet Explorer') {
document.write('<OBJECT ',
'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"',
'width="200"',
'height="200">',
'<PARAM name="code" value="MyClass.class">',
'</OBJECT>');
}
else {
document.write('<p>Sorry, unsupported browser.</p>');
}
</script>
and this:
<object
codetype="application/java" classid="java:TableManager.class"
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
archive="my_jar.jar" width="740" height="400">
<param name="code" value="MyClass.class">
</object>
and this:
<applet code="MyClass.class" archive="my_jar.jar" type="application/x-java-applet" height="300" width="550"></applet>
But nothing worked, do you have any suggestions?
Upvotes: 0
Views: 937
Reputation: 718758
Many modern web browsers don't support Java applets at all anymore, and those that do require the user to explicitly enable support.
Why? Because Java plugins for web browsers were notorious for security flaws that put the user of risk of having their computer hacked via a malicious applet.
My recommendation is that you change your application architecture to avoid any need of running Java in the user's browser.
If you can't do that, this Oracle page gives instructions for various web browsers on how to get Java working in the browser:
Note that the instructions need to be followed by the end user.
Upvotes: 1