• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDK 1.5 Compiled Applet not working with JRE 1.4

 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

If I compile my applet using JDK1.5 then this applet do not get loaded on a system using JRE1.4 however it works fine with systems having JRE 1.5. Isn't JDK 1.5 backward compatible.
Can anyone please help. Below is the tag, I am using tp display applet in my JSP

<div align="center">
<applet
codebase = "."
archive = "WebPOSApplet.jar"
code = "webposprint.DebitMainApplet.class"
name = "Trans Applet"
width = "450"
height = "112"
hspace = "0"
vspace = "0"
align = "middle"
>
<param name = "sourceInfo" value = "DebitTrans.do">
<param name = "redirectInfo" value = "SearchProducts.do">
</applet>

<%/* %>
<OBJECT classid = "clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA"
codebase = "http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0"
WIDTH = 450 HEIGHT = 112 >
<PARAM NAME = CODE VALUE = webposprint.DebitMainApplet.class>
<PARAM NAME = archive VALUE = WebPOSApplet.jar>
<PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.4.2">
<param name = "sourceInfo" value = "DebitTrans.do">
<param name = "redirectInfo" value = "SearchProducts.do">
<PARAM NAME = "scriptable" VALUE = "false">
<PARAM NAME = model VALUE=models/buckminsterfullerine.xyz>
<COMMENT> <EMBED
type = "application/x-java-applet;jpi-version=1.4.2" \
CODE = webposprint.DebitMainApplet.class\
archive = WebPOSApplet.jar\
WIDTH = 373 \
HEIGHT = 167 \
model =models/buckminsterfullerine.xyz \
scriptable = false \
pluginspage = "http://java.sun.com/products/plugin/index.html#download"> <NOEMBED>
alt="Your browser understands the <APPLET>
tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET>
tag! </NOEMBED> </EMBED> </COMMENT>
</OBJECT>
<% */%>
</div>

Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Amique-

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it - please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In regard to your question, class files created by 1.5 are not generally compatible with 1.4 JVMs. Check this page for details. There are ways of improving the backwards compatibility; check this page for certain compiler switches you can use, particularly -source and -target.
 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Thanks for update about name policy. Anyways if I use -source 1.5 and target 1.4, in that case will applet work with JRE1.5
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amir Rafique:
in that case will applet work with JRE1.5


JDK 1.5 will run any older class file version; but older ones won't run newer versions. It's the same with, for example.Microsoft Word: Word 4 and 5 won't read Word 6 or Word 97 format, but Word 97 would read all those formats.
 
Amirr Rafique
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys

I am using following command in ANT script to compile my applet code

But still my applet is not working with JRE1.4 (It works fine with JRE 1.5). I gives me following exception

java.lang.UnsupportedClassVersionError: (Unsupported major.minor version 49.0)


Can any one please help to get me out of this

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't use source="1.5" with an earlier target version. If you want to compile for 1.4, you have to use source="1.4" and not use any 1.5 language features.
 
Mohammad Farhat
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Amir,
why don't you compile your applet with jdk 1.4, this way you will guarantee that it will work with both 1.4 and 1.5
in case you get errors in compilation, you will need to find workarounds (these maybe the same ones causing jre1.4 not to run your applet)
Best,
Mohammad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic