0

My Java applet only supports 1.4 java run time(1). I am having one machine on which both Java 1.4 and 1.6 environment is installed. Is there some setting available by which I can make sure my applet will always use Java 1.4 run time when it runs?

  1. We are using key event class private data array bData with the help of Java reflection. The data which is there in this array JDK 1.4 and 1.6 is different in both the version.
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Devloper
  • 219
  • 2
  • 5
  • 12
  • What is the reason it does not support a newer JVM? – Thorbjørn Ravn Andersen Aug 05 '11 at 11:44
  • 2
    In which way does it only support Java 1.4? Because of libraries? Note that compiled Java 1.4 code should run in a Java 6.0 environment, too. Can you provide more specific information? – Thomas Aug 05 '11 at 11:45
  • 1
    I don't think that it is possible to create applet that works on 1.4 and not on 1.6. If you have, please edit your question to show specific code that results in the incompatibility. – bmargulies Aug 05 '11 at 11:46
  • I just wondering, if any machine can run different JVM using only one JAVA_HOME. And the problem is not about applet, its common to any java application. Isn't it funny to try something like that? – Kowser Aug 05 '11 at 11:58
  • I have looked at http://www.coderanch.com/t/385817/java/java/Accessing-private-data-AWTEvent-class example and also use scancode variable. Setting a JAVA_HOME to 1.4 is also not working... We dont want to use JAVA 1.6 for my applet. – Devloper Aug 05 '11 at 12:09

3 Answers3

1

A Java application compiled with JDK 1.4 will run on JDK 1.6.

You can compile a Java application with JDK 1.6, but compatible with JDK 1.4 by configuring the 'source level'.

Although you can choose your default JDK to be safe, but it depends on your operating system. If you are on Linux, you can choose between available Java versions using pdate-alternatives --config java command (which will modify some symlinks in the hindsight).

n0rm1e
  • 3,796
  • 2
  • 28
  • 37
0

There's a way to force a specific installed version to run, but if one Java plugin replaces the other there might be an issue with this. See linked question for further details.

Force Internet Explorer to use a specific Java Runtime Environment install?

Are there any issues with running the 1.4 code on 1.6? If not, you should be fine. Just avoid using anything in the classpath that changed significantly between these versions. Otherwise, look [here][1]. The codebase download thing is interesting, since it lets you download a different classpath. So, regardless of the JRE version, you could force the download of a 1.4 JRE classpath, which should ensure full compatability.

Edit: found an updated guide to using previous classpaths with newer Java versions in applets, which actually seems to work:

http://download.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html

Edit 2: I actually have it working, but it appears to need to download JRE 1.4 and install it, but then it will run the applet with it automatically. However, this might be suitable for your needs.

http://www.2shared.com/file/bl3Rua2e/applet.html -- extract the archive, and then run index.html inside this. All source code is included.

Community
  • 1
  • 1
Chris Dennett
  • 22,412
  • 8
  • 58
  • 84
0

On Windows 7:

Control Panel -> Programs -> Java

Select 'Java' tab, and View the Java Runtime Environment settings. Ensure that your Java 1.4 entry is selected.

Andrew Fielden
  • 3,751
  • 3
  • 31
  • 47