Help pls : Sandboxed Java Local/WebStart and BImage..

Hello!

i have no earlier experience with Java Application Sandboxes, this is my first…
i have an following code, it compiles ok and it runs ok from my netbeans ide…
my problem comes when i try to run my executable.jar file from my windows xp by doubleclicking it…
the following code when compiled to jar only returns frame with gray background, no image,

i have tryed to explore google but i have not found an answer…

so, could someone please help a poor coder with why gif wont get displayed when jar is runned localy by doubleclick or from homepage with jnlp ??

i really want to run my application on a sandbox, i dont have similiar problems with signed jars ?


package components;

import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;

public class myDemo extends Canvas
{       
    public myDemo()
    {
        JFrame frame = new JFrame("DamnGood-kickoff!");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Dimension dim = new Dimension();
        dim.width  = 640;
        dim.height = 480;
        this.setSize(dim);
        frame.getContentPane().add(this);
        frame.setLocation (200,200);        
        
        BufferedImage bimg = loadBImage ("/kuva_002.gif");
                               
        frame.pack();
        frame.setVisible(true);
        
        while ( true == true )
        {
            try {
                Thread.sleep(100);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
            this.getGraphics().drawImage(bimg, 0, 0, this);
        }
    }     
//---------------------------------------------------------------------------------------
// BufferedImage loader..
    public BufferedImage loadBImage ( String resr )  {
        try {
            BufferedImage bimg;
            bimg = ImageIO.read(new BufferedInputStream(getClass().getResourceAsStream(resr)));
            return bimg;
        } catch (Exception e) {
            System.out.println("Error loading image: " + resr + " " );
            System.exit(0);
            return null;
        }
    }
//---------------------------------------------------------------------------------------
    /**
     * Create the GUI and show it.  For thread safety, 
     * this method should be invoked from the 
     * event-dispatching thread.
     */
    public static void main(String[] args)
    {
        myDemo demo = new myDemo ();
    }
}

security manager is null in the standard sun implementation under windows wen running applications.

are you sure you included it in the jar?

----windows security manager is null in the standard sun implementation under windows wen running applications.

----are you sure you included it in the jar?

i have never heard about windows security manager, this is my first sandbox application…
i have netbeans ide and my applets and signed applications jar files have always worked just fine…

is windows security manager a jar file that i need to include, please tell me more about it, maybe a link…
i dont understand why i need wsm with sandboxed applications, i have compiled signed jars and they have always worked ok…

if i include wsm does it mean that my jar files still work with Linux and Mac ??

I think he means, if you are sure that the image is included in the jar.

:smiley: ;D :smiley:

Yes, the image is included in a JAR…but i receive gray background…

[edit] SOLVED, my image extension was .GIF i tryed to load .gif,

thanks,

sorry I tried to reformulate my sentence, forgot to remove windows.
I was talking about http://java.sun.com/javase/6/docs/api/java/lang/SecurityManager.html

[quote]executable.jar file from my windows xp by doubleclicking it…
[/quote]
means it’s being run as an application. and thus the SecurityManager is null. Making it unlikely that it’s throwing a SecurityException (what does the java console say?)

I’m pretty sure every implementation runs applications with SecurityManager being null, however, it’s not explicitly written down in the specification.

most likely your problem has to do with the application being unable to find the image, not with security restrains.

// Warning - while you were typing 2 new replies have been posted. You may wish to review your post.
thats what’s I was getting at.