File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Can java 1.4 emulate 1.3 ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can java 1.4 emulate 1.3 ?" Watch "Can java 1.4 emulate 1.3 ?" New topic

Can java 1.4 emulate 1.3 ?

Tom Hughes
Ranch Hand

Joined: Feb 09, 2002
Posts: 86
Because I want to run 1.3 apps and 1.4 apps on the same machine (WinNT).
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
You should be able to run 1.3 classes under 1.4.
You MAY not be able to run 1.4 apps under 1.3 depending on what classes were used.
You CAN have both JRE's implemented on the same machine, and just switch the classpath etc when you execute the apps.
Make a .bat file and put your command to invoke the application in there. Include the classpath to the version of the JRE that you want as a parameter when you invoke the app.
Then just run the bat file.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

Two gotchas-->
1- if you're on Windows, you might have to mess around with your registry to switch between versions.
2- if your JDK 1.3 app uses a method called .assert() you'll have issues as this is a new key word in 1.4

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
The assert thing is something that could cause a problem.
However, I believe if you explicitly name your classpath in your execution statement, that it overrides the classpath parameter in the Windows Registry.
This is a .bat file that we use to insure that the user in picking up the version of the JRE that we want:
set E2_RUN_DIR=c:\E-Squared\
"c:\program files\javasoft\jre\1.3.1\bin\java" -classpath .;"c:\program files\javasoft\jre\1.3.1\lib\rt.jar";wleclient.jar;m3envobj.jar;jh.jar;evpa-live.jar;report11_pro.jar;report12_pro.jar;javaARM.jar -DWSS_DIR=%E2_RUN_DIR% com.myCompany.evpa.wss.Wss
invoke the Wss.class file using the file as a parameter.
I agree. Here's the link:
subject: Can java 1.4 emulate 1.3 ?
jQuery in Action, 3rd edition