Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Help pls : Sandboxed Java Local/WebStart and BImage..  (Read 953 times)
0 Members and 1 Guest are viewing this topic.
Offline mrSure

Senior Newbie





« Posted 2007-07-30 13:21:27 »

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 ?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
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 ();
    }
}
Offline Mr_Light

Senior Member




shiny.


« Reply #1 - Posted 2007-07-30 13:48:24 »

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

are you sure you included it in the jar?

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline mrSure

Senior Newbie





« Reply #2 - Posted 2007-07-30 13:57:21 »

----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 ??
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cylab

JGO Knight


Medals: 34



« Reply #3 - Posted 2007-07-30 14:07:17 »

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

Mathias - I Know What [you] Did Last Summer!
Offline mrSure

Senior Newbie





« Reply #4 - Posted 2007-07-30 14:11:30 »

 Cheesy Grin Cheesy

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,
Offline Mr_Light

Senior Member




shiny.


« Reply #5 - Posted 2007-07-30 14:15:26 »

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..
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.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (51 views)
2014-04-15 18:08:23

BurntPizza (48 views)
2014-04-15 03:46:01

UprightPath (63 views)
2014-04-14 17:39:50

UprightPath (45 views)
2014-04-14 17:35:47

Porlus (62 views)
2014-04-14 15:48:38

tom_mai78101 (86 views)
2014-04-10 04:04:31

BurntPizza (146 views)
2014-04-08 23:06:04

tom_mai78101 (243 views)
2014-04-05 13:34:39

trollwarrior1 (202 views)
2014-04-04 12:06:45

CJLetsGame (209 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!