*** MOVED ***

NOTE: I have merged the contents of this blog with my web-site. I will not be updating this blog any more.

2007-04-13

Running Java Applets in Internet Explorer on Linux

One of the unfortunate things about the current state of the internet is that some web sites refuse to work with anything other than Internet Explorer (IE). Some of these also require you to run Adobe Flash Player and/or Sun's JVM within IE. Most of these sites can be happily avoided, but some of them just can't, especially when they run important applications within a corporate intranet. This can seriously dampen the enthusiasm of people willing to try out Linux as their primary desktop.

WINE allows you to run many a Windows application natively on Linux, including IE (albeit with a few tweaks). IEs4Linux makes it really simple to install one or more versions of IE on your Linux system, something that is very difficult on Windows itself, if not impossible! You can also view Flash content and run Java applets within such an IE. The latter requires a bit of tweaking with the current release of WINE (0.9.34), if you want to use Sun's JVM instead of that provided by Microsoft, as explained below.

Install a version of IE using IEs4Linux into, say, $HOME/.ies4linux (the default). Assuming that you choose to install only IE 6.0 SP1, IEs4Linux will create a WINE "bottle" named "ie6" within "$HOME/.ies4linux", separate from your regular WINE bottle (which is present by default in "$HOME/.wine"). IEs4Linux can also automatically install Adobe Flash Player along with IE. Run IE at least once to verify that it is working.

Now install the Java Runtime Environment (JRE) making sure that you correctly specify the WINEPREFIX environment variable by pointing it to the IE WINE bottle. For example:

export WINEPREFIX=$HOME/.ies4linux/ie6
wine jre-1_5_0_11-windows-i586-p.exe

For some reason, RegUtils.dll is not correctly copied during the installation of the JRE and therefore you must copy this file from a Windows machine that has exactly the same version of the JRE. This file is usually found in the "bin" sub-folder of the JRE installation folder. Without this file, the Java Control Panel applet will not be able to register Sun's JRE with IE.

Now run the "javacpl" programme found in the "bin" sub-folder of the JRE installation folder. With the current WINE release, this would cause your display to flicker or black out since it does not yet fully support DirectX-based acceleration (but where the maximum development effort currently seems to be directed). To avoid this, you can also invoke the Java Control Panel applet alternatively like this in the "lib" sub-folder of the JRE installation folder:

java -classpath deploy.jar \
-Dsun.java2d.noddraw com.sun.deploy.panel.ControlPanel

Go to the "Advanced" tab and uncheck the check-box for "<APPLET> tag support" for "Internet Explorer", apply your changes and close the applet. Restart the applet once again and this time check the check-box, apply your changes and close the applet. You should now be able to see Java applets within IE using Sun's JRE.

If you wish to avoid the flicker/blacking-out of the display whenever you run Java GUI applications, you can either pass the JVM option -Dsun.java2d.noddraw to Java applications and applets or disable DirectX-based acceleration for Java 2D completely by looking for a registry key like:

HKEY_CURRENT_USER\Software\JavaSoft\Java2D\1.5.0_11

and setting the value of "DXAcceleration" to "0". (WINE includes a "regedit" programme just like its Windows counterpart.)

With IE, Flash and Java Applets with you, you are now ready to savour the worst of the internet first-hand on your Linux desktop instead of hearing about it from your friends who use Windows.

(The method outlined here seems to work with WINE 0.9.34 on Fedora Core 6, IE 6.0 SP1 as installed by IEs4Linux 2.0.5 and Sun's JRE 1.5.0_11 - your mileage might vary.)

Update (2007-07-03): With WINE 0.9.40 on Fedora 7 and Sun's JRE 1.5.0_12, I don't see the problem with "RegUtils.dll" and the JRE installs just fine. Another way of avoiding the blackening of the entire desktop while using Java Swing applications (and for getting a much more accurate display) is to enable a "virtual desktop" that will hold your Windows applications. To do this, invoke "winecfg", select "Enable a virtual desktop" under the "Graphics" tab and provide a size for the virtual desktop (say, 800 by 600 or 1024 by 768).

Update (2007-10-31): The default location used by IEs4Linux is $HOME/.ies4linux (notice the period in front of the directory name). Changed the post to use this location instead as people were getting confused by the location used earlier.