Image loading problem on internet Explorer

Hello EveryBody

I am doing an java game.My starting class is a class that extends JApplet.Then I am calling a class that extends JFrame.Then i am calling a class which extends a canvas.In the constructor of my canvas class i call a method loadImage(),which loads all the images used in my game.My game is working fine in appletViewer.but it is not working in internet Explorer.When I commennted the method loadImage() inside consructor of canvas class ,then my game is working on internet Explorer.I think there is some problem in loading the images.I am using .png images,which has a size of 87.2KB only which is very little as compared to an PC game.plz help me

Regards

Srikant

[705 byte] By [srikanta] at [2007-10-2 14:21:49]
# 1
Look and see what VM is enabled for Applets in IE. The default is MS (usually) and you may be running into a VM mismatch problem.
morgalra at 2007-7-13 12:40:08 > top of Java-index,Other Topics,Java Game Development...
# 2
Thanks for ur suggesionBut how to see what VM is enabled for Applets in IE.I don't understand ,"The default is MS (usually)"how to avoid VM mismatch problem.Thanks Srikant
srikanta at 2007-7-13 12:40:08 > top of Java-index,Other Topics,Java Game Development...
# 3

internet explorer by default uses the MSVM (microsoft's version of the Sun VM). This VM only runs Java 1.1 code. You can check if this is the problem by using this 1.1-compliant applet below:

import java.applet.*;

import java.awt.*;

public class Test extends Applet {

public void init() {

setLayout(new FlowLayout(FlowLayout.CENTER));

add(new Label(System.getProperty("java.version")));

}

}

compile that code with these parameters:

javac -target 1.1 Test.java

use this HTML:

<applet code="Test" width="400" height="400"></applet>

when you run the applet in Internet Explorer, if you see anything about "Java 1.1" or something similiar, then the problem is that IE is using the MSVM instead of the Sun VM.

You may want to also run this applet in [url=http://getfirefox.com]Mozilla Firefox[/url], because Firefox uses the correct JRE that is installed on the system. If the applet running in Firefox does NOT say 1.1 (e.g 1.4, 1.5, etc), then you have the correct JRE. In this case, go to Internet Explorer -> Tools -> Internet Options -> Advanced. Scroll down this list until you see the checkmark that says "Use JRE x.x.x for <applet> tag (requires restart)." Ensure this box is checked.

If that box is already checked, or if the applet in Firefox also says "1.1," then you probably don't have the latest JRE installed. See http://java.com/ to grab the latest JRE.

Woogleya at 2007-7-13 12:40:08 > top of Java-index,Other Topics,Java Game Development...
# 4
Thanks for ur replaywhen i am running your code in applet viewer version gives is - 1.4.2_04.when it is running on IE version gives is -1.4.2_08when it is running in fireFox it gives a version is - 1.4.2_08Regards Srikant
srikanta at 2007-7-13 12:40:08 > top of Java-index,Other Topics,Java Game Development...
# 5
have you tried loading your images with [url= http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/ImageIO.html]ImageIO[/url]? E.g:BufferedImage b = ImageIO.read(getClass().getResource("image.png"));
Woogleya at 2007-7-13 12:40:08 > top of Java-index,Other Topics,Java Game Development...
# 6
HiI have not tryed BufferedImage b = ImageIO.read(getClass().getResource("image.png"));I am trying suits = Toolkit.getDefaultToolkit().getImage("suits.gif"); where suit is an Image objeject i.e i declared as Image suit ;I will try ur code.Regards srikant
srikanta at 2007-7-13 12:40:08 > top of Java-index,Other Topics,Java Game Development...