*** 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.

28 comments:

  1. I've been meaning to post on this for a few days. This is truly, truly evil! Congratulations :-)

    ReplyDelete
  2. Actualy you do not need a computer with windows to copy RegUtils.dll, because you can copy the file from another directory created by Java Installer. In my case (Java 1.5.0_11) the directory was: $HOME/.ies4linux/ie6/drive_c/Program Files/Common Files/Java/Update/Base Images/jre1.5.0.b64/patch-jre1.5.0_11.b03/

    ReplyDelete
  3. Cordial Greetings:
    I am Suse Linux 10.1 User

    java -version
    java version "1.6.0_01"
    Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
    Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

    I have (copied from Windows System Folder) the installation of JRE with Windows Flavor in a Folder called "/usr/local/ies4linux/ie6/drive_c/Archivos de programa/Java/jre1.6.0_01"

    I have Already IEs4Linux Running.
    I need to install the Windows Version of JRE 1.6.0_01.

    The Installation Where is placed?
    What user privilegies is recommended for java normal user or root?

    Thanks...

    I obtain the installation is finished, but where is placed?

    ReplyDelete
  4. Anonymous: The default location for the JRE installation, say for version 1.6.0_01, is usually "C:\Program Files\Java\jre1.6.0_01" ("Program Files" seems to be named "Archivos de Programa" in your locale).

    If you just copy over an installation from a Windows machine to your WINE folder, the WINE Windows registry entries will not be populated and the JRE will not work properly - you should therefore try to install it using the JRE installation executable that you downloaded from Sun's site.

    ReplyDelete
  5. Thanks! It works on 64bit Ubuntu Feisty aswell. You have just saved the day for a linux newbie!

    ReplyDelete
  6. Awesome! Thanks a lot! But would you PLEASE post an articel HOW do you find this out (step by step) ?
    So others (like me ;) ) could learn something and may adjust it to other problems like that! Thx in advance and best regards! hp

    ReplyDelete
  7. Thank you! Your DXAcceleration=0 tip solved my display corruption in Ubuntu. I searched all over the net and was surprised that it was not widely documented.

    ReplyDelete
  8. Thanks for the great hints you provide on your site. It's awesone to be able to run Java on IE under wine/linux.

    Unfortunately my stupid bank -BANAMEX in Mexico, if anyone cares- requires for online banking to use Internet Explorer AND the latest version of Java.

    Since I use linux (and linux only), your hints seemed like a great opportunity. I managed to make Wine 0.9.36 / IE 5 / Java 5.0.11 work, but my bank's site wont work with Java 5.

    So, the question remaining is: How to make Java 6 work ? (with the same Wine 0.9.36 or better, IE 6).

    BTW, my IE6 was intalled on wine with the great ie4linux script which in turn sets Wine with Windows 98 behavior. Wonder if Java 6 would work on a windows 98 machine -virtually speaking, of course ;) -

    Cheers and thanks !

    ReplyDelete
  9. Anonymous: As you remark correctly, IEs4Linux sets "Windows 98" as the emulated version of Windows. As noted on this page, JDK 1.6 is not supported on Windows 95/98/ME.

    So your bank doesn't even support Windows users running Windows 98/ME! I think you should lodge a complaint with their customer support.

    ReplyDelete
  10. Thank you very much for your excellent guide, it really helped me a lot on browsing IE Only Sites that uses Java Web Applets, especially the bank's website.

    By following your guide, I've used the same jre-1.5.0_11 version along with my Ies4linux without any problems on the WINE versions 0.9.51, or older versions, but everything went wrong after WINE has been upgraded to 0.9.52, .53, and .54, which causes ies4linux to crash whenever a Java Applet is executed.

    Do you have any solutions on this please?

    Thanks!

    ReplyDelete
  11. Anonymous: Sorry, I haven't tested this with recent versions of WINE. When I get some time, I would try it out and see if I see the same problem.

    ReplyDelete
  12. jre 1.6 update 5 and wine version 0.9.57 .. install but doesn't work even with the ddraw flag /or gegister
    throw java exceptions about swing[error] main: Exception in thread "main"
    [error] main: java.lang.IllegalArgumentException: Noncontiguous red mask
    and many more

    ReplyDelete
  13. I run "wine javacpl.exe" as described in the article and I do unchecking/checking the check-box for the APPLET tag support. Unfortunately after clicking on "Apply" I am getting message "Unable to Change Browser Settings Please check if you have sufficient permissions to change system settings." Any advice what might be wrong? Mirek

    ReplyDelete
  14. Mirek: Some things to check:

    1. You should be running the Java Control Panel applet as the user who created the WINE "bottle" into which you have installed IE.

    2. You should have set the WINEPREFIX environment variable appropriately. For example, if you have installed IE 6 from IEs4Linux into $HOME/.ies4linux/ie6, you should set WINEPREFIX to "$HOME/.ies4linux/ie6".

    ReplyDelete
  15. Thanks for reply. I am running the Control Panel as the same user who created the WINE bottle (I have only one user account on my system) and I have the WINEPREFIX set correctly. The message is displayed by the Control Panel applet - not Linux itself.

    Ubuntu 7.04, Wine 0.9.33-0ubuntu1, jre 1.5.0_15-b04

    Mirek

    ReplyDelete
  16. Mirek: I tried WINE 0.9.56 as well as WINE 0.9.58, but could not get JRE 1.5.0.15 to work (on Fedora 8).

    I even tried it out with the latest beta release of IEs4Linux (2.99.0.1) without success.

    All I can suggest at this moment therefore is that you try with WINE 0.9.40, since that was a version that worked (at least for me).

    I didn't try out WINE 0.9.59, which is the current release and is supposed to contain a lot of bug-fixes.

    ReplyDelete
  17. rmathew,

    So far I've tested JRE 1.5.0.11 on wine 0.9.44~0.9.51, all worked fine by configure it according to your detailed instructions mentioned above.

    But everything went wrong since 0.9.52...

    However, I find the latest 0.9.60 might be able to run Sun Jre 1.6.06, I've managed to get it work on one of my Ubuntu 8.04 machine, but failed to run on my other Ubuntu 8.04 PC.

    I first tried to compile the 0.9.51 from source, and then I immediately installed the 0.9.60 Deb package downloaded from winehq, now WINE seems able to run BOTH jre 1.5 (using Win2K mode under '~/.wine')
    AND JRE 1.6 (using Win98 mode under '~/.ies4linux/ie6')


    But 'wine --version' shows that my current version is 0.9.51 and not 0.9.60 which I have installed by 'dpkg -i'

    Really strange...

    Bryan

    ReplyDelete
  18. Update:

    Working Wine versions for the above mentioned method:

    1. Wine 0.9.44~0.9.51

    2. Wine 0.9.61 (bug: cannot input Chinese Characters into java applets, however, English/Latin characters should have no problems)

    3. Wine 1.0 RC1!!!

    Yes, it's out today:

    http://wine.budgetdedicated.com/archive/ubuntu/hardy/wine_1.0~rc1~winehq0~ubuntu~8.04-1_i386.deb

    Wine 1.0 RC1 works!

    One more thing: the blinking screen problems when scrolling a page in ies4lunix seems fixed!

    Regards,
    Bryan

    ReplyDelete
  19. Bryan: Thanks for all your testing.

    A shorter version of the URL you have posted is:

    http://preview.tinyurl.com/6zzjxb

    ReplyDelete
  20. Thank you very much! It worked 100%.
    Grateful, Horacio Lobo

    ReplyDelete
  21. I managed to get Webex to work using wine in case anyone is interested:
    http://ubuntuforums.org/showthread.php?p=6759268#post6759268

    ReplyDelete
  22. Hi

    I wanted to point out (cos i spent an insane amount of time to get this to work)..that you have to make sure you download jre-1_5_0_11-windows-i586-p.exe and not the latest JRE..cos that wont install to the ie6 winebottle..

    ReplyDelete
  23. I have problem, I am new to Ubuntu jaunty
    on my laptop .wine is in my directory home/jni/.wine
    and ie6 at /home/jni/.ies4linux/ie6
    when I put in terminal
    export WINEPREFIX=$home/jni/.ie4linux/ie6
    and then
    cwine jre-1_5_0_11-windows-i586-p.exe
    it gives error
    wine: chdir to /jni/.ie4linux/ie6
    : No such file or directory

    Please help

    ReplyDelete
  24. Jay: References to environment variables are case-sensitive. You need to say "$HOME" instead of "$home".

    If "$HOME" expands to "/home/jni", you just need to say:

    export WINEPREFIX=$HOME/.ie4linux/ie6

    ReplyDelete
  25. Thanks for advice.
    mean time I got upgraded to Ubuntu 9.1
    I am on ubuntu 9.1 , and wine 1.1.31
    I am new to Linux also.

    I followed your instruction for ie6
    Used Megha'a advice and using jre-1_5_0_11

    I did following...
    export WINEPREFIX=$HOME/.ies4linux/ie6
    terminal cursor goes to next line
    wine jre-1_5_0_11-windows-i586-p.exe
    Cursor goes to next line and then remains there nothing happens now.

    Please guide.

    ReplyDelete
  26. guys same thing is happening with me,please help

    ReplyDelete
  27. OMG I've been trying to get this right for the past week to no avail! *laughs maniacally* Change the DirectX acceleration to 0 - of course! You are my friend!!! you... I... ohhhhh... lol

    ReplyDelete
  28. thanks for the excellent instructions. my only necessary modification was when running the ControlPanel applet from the lib subdirectory; I had to specify the path to the java executable:

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

    ReplyDelete

Note: Only a member of this blog may post a comment.