Java 1.1 compatibility: how to go about it (in this case)

I’m developing a Tetris java applet clone that I want to be compatible with Java 1.1 however I am still able to use classes that are not available 1.1 in eclipse without any problems (despite setting it to compile in Java 1.1 compatibility). It makes coding a little uncomfortable, especially since I cannot be sure that it is doing what it says on the box (i.e. compiling for java 1.1).

My current setup is:

  • Eclipse 3.2.1 with JRE 1.6.1_01 and the appropriate documentation

Will I have to resort to command line compilation or something when doing the final build.

you may not be able to compil if you set -target 1.1 to javac ??! no ?

javac Sample.class -target 1.1

Ahh, I’ve found what the problem is; though the compiler is compiling for 1.1 byte code compatibility it does not stop you from using newer methods for some reason. The only way to get warnings for that is to use JDK 1.1, which isn’t too bad because what I will do is create everything in Eclipse as normal and occasionally compile with JDK 1.1 to make sure there are no incompatible functions, etc.

Also the lowest source compatibility I can get is 1.3; I don’t think there is a workaround for that in eclipse although I will restart the computer and see if Eclipse will be compatible with the older runtime and JDK

EDIT: Java 1.1 is completely incompatible with the later versions so I have had to remove the recent version in order to compile with 1.1 and I am starting to get into the flow of it. No eclipse and I will have to install MSys so that I can make use of makefiles.

EDIT: Wait, no freaking way am I getting with of java 6.0; I just realized what’s running on that; well at least I got the important parts changed, I think I can continue in Eclipse and revert to 1.1 at the final stage. Although I do remember there being differences in Vector such as no get(n)

The only way to be reasonably sure is to actually compile for delivery with java 1.1.
That’s what I do.

Which JRE/JDK are you using? The earliest compatibility I can work with is 1.3 code compatibility with 1.1 class compatibility when compiling with JRE 6 in Eclipse.

What I have done is compile with JDK 1.1 and find out what is compatible, then continue development and will tie back with 1.1 once my engine is secure. But many classes have been changed such as Vector, and plenty of others so I can never be sure when using any API class (including Vectors).

If there is a way to have Eclipse aware of the limitation it would be great! Also I cannot run the 1.1 JRE with the recent JRE installed as they have terrible conflicts. This also means that Eclipse is a no-no!

I do development with eclipse and the latest JDK, but I remain aware of what features
are not available in JDK1.1. I use JDK1.1 itself to compile for delivery, not any compatibility
mode, and occasionally I actually run with JDK1.1 when looking for an obscure bug in
the deployed applet.

BTW, with all the different JREs, Browsers, and platforms out there, you can be sure that there are bugs
that will only show up in actual use. It’s not just a matter of defined APIs that don’t behave exactly the same;
lots of detailed behavior is unspecified, and varies seemingly at random. I speaking of things such
as if you are guaranteed to get a “mouseenter” message if the mouse enters by the window appearing
under it.

The only way to be really sure in Eclipse you’re compiling 1.1 compatible code is to set .class file compatibility to 1.1 and to reference a java 1.1 rt.jar instead of the 1.6 rt.jar (In your Project properties, Java Build Path -> Libraries, replace the JRE System Library with the java 1.1 one). Afaik, source compatibility is not really important here.

Oh right, only problem is that I cannot have JRE 1.1 and JRE 6 installed at the same time as it makes java run a little odd; although maybe I could try to work something out.

Maybe you could try to install the 1.1 jre, copy the installed directory (or perhaps only the rt.jar file), and uninstall the 1.1 jre.
Then re-install 1.6, and finally make the reference from Eclipse to the 1.1 rt.jar file (in de copied jre 1.1 installation).
A bit messy but I think it should work.

One thing I remember during my time at uni is that you can bundle a JRE with your package in some way. There was a CD with Eclipse going round on campus that allowed you to run Eclipse without installing Java; I doubt I still have it but it was pretty nifty and I could at least be able to demonstrate the project to my manager without being tied to Java 1.1

I will try that method though just so that I can be sure that it works

It seems I have a solution; bundling JRE and JSmooth!!! At least I have a viable fall-back and no longer have to worry about that issue in Windows (which most of my clients without a JRE will be running).

Well bundling a jvm means its application-private which means other java-apps will not able to use it.
This means users end up with having 15 different Java runtimes installed and each applications uses its own.

JSmooth also allows to point users to java’s website and download a global-jvm which will also help other java apps and reduces the mess on the client computer.

lg Clemens

I think you missed the whole, “they don’t have the option of installing” part.