Hot questions for Using Applets in internet explorer

Top Java Programmings / Applets / internet explorer

Question:

I have application build with Java Applets, which works fine for Windows 7 with IE 9. Now I'm trying move it to another environment. There is Internet Explorer 11.

To run applet I'm using Oracle Deployment Toolkit Script with latest version taken from https://www.java.com/js/deployJava.txt. But the script doesn't detect Java Plugin. It only redirects to page java.com (suggesting to download latest JRE).

But my browser has Java Plugin installed (here JRE 1.7.80):

There are also two SSV Helpers - maybe they cause the problem?

Java 8 (u144) cause the same problem.

Question:

How to detect Java Plugin in IE 11 and run applet?

Is it problem with deployJava.js or IE 11 configuration?

More explanations:

Oracle deployJava.js script uses such code to detect JRE version in IE (deployJava source - lines 1172-1188):

testUsingActiveX: function(version) {
    var objectName = 'JavaWebStart.isInstalled.' + version + '.0';

    // we need the typeof check here for this to run on FF/Chrome
    // the check needs to be in place here - cannot even pass ActiveXObject
    // as arg to another function
    if (typeof ActiveXObject == 'undefined' || !ActiveXObject) {
        log('[testUsingActiveX()] Browser claims to be IE, but no ActiveXObject object?');
        return false;
    }

    try {
        return (new ActiveXObject(objectName) != null);
    } catch (exception) {
        return false;
    }
},

Unfortunately, ActiveX seems to be limited, restricted or disabled in IE 11. This topic on SO is here... anyone knows any details?

I run manually (in IE 11.1480 developer console) this code:

new ActiveXObject('JavaWebStart.isInstalled.1.8.0.0');

which returns:

Automation server can't create object

But running the same code in a bit older IE 11.09600 returns object:

[object] { }

I'm confused... Can Oracle do the script better?

Specification:

Internet Explorer 11, Version: 11.1480... Update Versions: 11.0.44

System: Windows Server

Java: tested with 1.8.144 and after 1.7.80

Applets run by Oracle deployJava.js


Answer:

I've found a solution:

Applets requires 32-bit JRE installed on client machine (and as IE Plugin). Or to be more specific IE ActiveX mechanism works only with 32-bit Java because all IE are 32-bit by default. There are also 64-bit IE version, but I don't try it.

I used the newest JRE 1.8u144 32 bit.

Some hints for anyone to make applets work (even in 2017):

  1. Check Internet Explorer version (32- or 64-bit) - look at Help -> About Internet Explorer, if there is no 64-bit info, then you probably use 32-bit. Check also Windows Task Manager and search for *32 processes. More info in other SO questions like this.
  2. Disable ActiveX Filtering may also help. But in my situation, this wasn't necessary because IE displays message which warn about running Java plugin and I just need to accept this.
  3. I have disabled option: Enable Protected Mode on Security tab in Internet Options window (for Internet zone).

More information can be retrieved from this discussion:

https://answers.microsoft.com/en-us/ie/forum/ie11-iewindows_10/cannot-access-secure-website-that-requires-java/173f732b-7377-41f6-8c6f-2ae171f4da7a?auth=1

Question:

I'm trying to access a Java Applet from IE 9. I'm using this code to create the applet:

var attributes = {
    id:'idApplet',
    code:'some.package.PrintApplet.class',
    archive:'Applet.jar',
    codebase:'<%=base_url%>/public/jar/',
    width:400,
    height:400
};

var parameters = {
    // Some parameters
};

var version = '1.5' ;

deployJava.runApplet(attributes, parameters, version);

But I'm getting this in my .jsp page:

This is the code of my applet:

public class PrintApplet extends Applet{

    // Some parameters

    public void init() {
        System.out.println("Started");
    }

    public void useLocalPrinter() {
        //some actions

    }
}

Answer:

If anyone has this problem again, it's very simple. I was exporting my JAR from Rational Application Developer (Eclipse based) and it wasn't being recognized by the JRE. I have to use ANT to compile my JAR and the problem was gone.

The ant snippet that i used was this:

<project name="applet" default="jar" basedir=".">

        <property name="jar.home" value="${basedir}/lib" />
        <property name="src.home" value="${basedir}/src-applet" />
        <property name="build.home" value="${basedir}/build-applet" />
        <property name="classes.home" value="${build.home}/classes" />
        <property name="jar.name" value="wami_audio_applet.jar" />
        <property name="jar.path" value="${jar.home}/jar.name" />

        <property name="compile.debug" value="true" />
        <property name="compile.deprecation" value="false" />
        <property name="compile.optimize" value="true" />

        <path id="compile.classpath">
                <pathelement location="${basedir}/lib" />
        </path>

        <target name="all" depends="clean, prepare, jar"/>

        <target name="clean">
                <delete dir="${jar.path}" />
                <delete dir="${classes.home}" />
        </target>

        <target name="prepare">
                <mkdir dir="${build.home}" />
                <mkdir dir="${jar.home}" />
                <mkdir dir="${classes.home}" />
        </target>

        <target name="compile" depends="prepare">
                <mkdir dir="${classes.home}" />
                <javac srcdir="${src.home}" destdir="${classes.home}" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="${compile.optimize}" target="1.5">
                        <classpath refid="compile.classpath" />
                </javac>
        </target>

        <target name="jar" depends="compile" description="Make the jar">
                <jar jarfile="${jar.home}/${jar.name}" basedir="${classes.home}">
                </jar>
        </target>
</project>

Question:

We have a signed applet that was working for a long period of time, but last week some of our clients using IE 8 + 9 started to complain that the functions exposed by our applet aren't working anymore which we verified on-spot and on our testing machines. We are a bit confused as each time we come up with a possible root-cause, we go and test it on the client machine and it it turns to be not the one.

Has anyone observed that Applets stopped to work lately on IE8+ in the last couple of weeks due to one of the following reasons:

  1. A Microsoft update.

  2. A Java update. (The current one we are using is Java8u45)

    Many thanks in advance :)

    *** Update: Some users reported the issue on Chrome now too and there are no signs that the page is loading the applet at all.


Answer:

Its Mainly the security issue by Java 8, Which is not allowing now to display or load the self signed Applets on browser. Please open configure java in settings and in security TAB put the URL of the html page which is using applet in Exception Site List

This should work for for. :)

Question:

I want to know if applets simply won't run anymore in IE.

I've searched quite a bit but the answer seems to keep changing based on versions and when this question is asked. So I'm looking for a simple authoritative answer.

Here's my setup:

  • Running IE 11 on Windows 7
  • Java 1.8.0_60 is configured as the Java runtime environment
  • No other Java versions are installed
  • "Enable Java content in browser" is checked
  • Java security setting is "high"
  • Site (local file for now) is specified in the Java security exception site list

I realize Java will no longer work in Chrome but is it still possible or not (using recent versions above) in IE as of today?

UPDATE:

I've added the security requirements to the manifest and I've self-signed the jar file but something still isn't quite right as the applet doesn't display its output.

Here's the manifest as it exists in the jar file:

Manifest-Version: 1.0
Application-Name: test
Permissions: all-permissions
Caller-Allowable-Codebase: *
Codebase: *
Application-Library-Allowable-Codebase: *
Build-Jdk: 1.8.0_60
Created-By: 1.8.0_45 (Oracle Corporation)

Name: HelloApplet.class
SHA-256-Digest: wkK+EUOV7eaecddcrIwBnjeZ+95GyyuK7OiVXR4XJ+4=

And here's the applet code:

import java.applet.Applet;
import java.awt.Graphics;

public class HelloApplet extends Applet {
    public void paint(Graphics g) {
        g.drawString("Hello world!", 50, 25);
    }
}

And here's the web page (UPDATED TO USE APPLET TAG)

<!DOCTYPE html>
<html>
<body>
    <applet code = 'HelloApplet' 
        archive = 'HelloApplet.jar'
        width = 300
        height = 300>
        <param name="permissions" value="all-permissions" />
    </applet>
</body>
</html>

Is there anything wrong here?


Answer:

Applets are still working in IE. But from 7u51 Java version, there have been new security requirements for the MANIFEST.MF file.

https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias

In short, you need at least to define Permissions, Codebase attributes.

Code snipped from my applet (META-INF/MANIFEST.MF in jar file):

Manifest-Version: 1.0
Application-Library-Allowable-Codebase: *
Application-Name: app-name
Build-Jdk: 1.7.0_79
Permissions: all-permissions
Caller-Allowable-Codebase: *
Codebase: *

Addition requirements depend on access permissions type the applet requires (all-permissions or sandbox).

More info: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/manifest.html