×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    problem in run code on eclipse(pulsar) !!!

    Hi ,
    i have problem to run my code in eclipse !!! whene i run this code on netbeans it`s successful runs but on eclipse this error is shown :
    Code:
    Null Pointer java/lang/NullPointer Exeption
    Code:
       1.   import java.io.IOException;  
       2.   
       3. import javax.microedition.lcdui.Canvas;  
       4. import javax.microedition.lcdui.Graphics;  
       5. import javax.microedition.lcdui.Image;  
       6.   
       7.   
       8. public class MapCanvas extends Canvas{  
       9.     Image x = null;  
      10.   
      11.     public MapCanvas() {  
      12.         try {  
      13.             x = Image.createImage("/1.jpg");  
      14.         } catch (IOException e) {  
      15.             // TODO Auto-generated catch block  
      16.             e.printStackTrace();  
      17.         }  
      18.     }  
      19.   
      20.     protected void paint(Graphics arg0) {  
      21.         // TODO Auto-generated method stub  
      22.         arg0.drawImage(x, getWidth()/2, getHeight()/2, 3);  
      23.           
      24.     }  
      25.   
      26. }  
      27.
    i copy image file (1.jpg) in res directory . i know problem is here
    Code:
    x = Image.createImage("/1.jpg");
    but i dont know why ???
    can any body help to me ???
    thanks

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: problem in run code on eclipse(pulsar) !!!

    Quote Originally Posted by mahdi68 View Post
    Code:
      16.             e.printStackTrace();
    What stack trace do you get?

    Quote Originally Posted by mahdi68 View Post
    Code:
      22.         arg0.drawImage(x, getWidth()/2, getHeight()/2, 3);
    You should use the constants (Graphics.LEFT, etc.), not a literal number.

    Graham.

  3. #3
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    What stack trace do you get?
    this shown on s40 emulator :
    Code:
    Null Pointer java/lang/NullPointer Exeption
    You should use the constants (Graphics.LEFT, etc.), not a literal number.
    it`s work on netbeans !!! i change it to (Graphics.RIGHT | Graphics.BASELINE) but again dos not work !!!

  4. #4
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: problem in run code on eclipse(pulsar) !!!

    An exception is being thrown from Image.createImage()... not the NullPointerException, a different one. You need to check what that is. That exception is telling you what went wrong.

    Don't use BASELINE for images, it's only for text. However, these are two separate issues.

    Graham.

  5. #5
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    i test this code on EclipsME and it`s work fine but it`s not work on pulsar !!!

  6. #6
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    yes you are right problem is here : Image.createImage("/1.jpg"); but why ?!?!?!? it`s work fine on netbeans and EclipseME !!! i can`t find why it`s not work on pulsar !!! i copy image file on res , src and root directory but again not work

  7. #7
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    What stack trace do you get?
    Code:
    Creating New "Series 40 5th Edition SDK,  Feature Pack 1" Instance ...
    Loading SdkConfig.dll
    Loaded
    Loading sdk.dll
    Loaded
    Smart card communication error 0x80100017
    The specified reader is not currently available for use
    Using Untrusted simulated domain
    	at javax.microedition.lcdui.Image.createImage(+55)
    	at HelloCanvas.<init>(+15)
    	at Hello.startApp(+7)
    	at javax.microedition.midlet.MIDletProxy.startApp(+7)
    	at com.nokia.mid.impl.isa.ui.MIDletManager.callStartApp(+4)
    	at com.nokia.mid.impl.isa.ui.MIDletManager.activateMIDlet(+10)
    	at com.nokia.mid.impl.isa.ui.MIDletManager.run(+15)
    java.io.IOException: Cannot read /1.jpg
    "Series 40 5th Edition SDK,  Feature Pack 1" Instance #6500500 Ready for Future Connections

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: problem in run code on eclipse(pulsar) !!!

    Open the "application descriptor" in the project, go to the "build" tab, and make sure that the file is included in the build.

    Graham.

  9. #9
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    i extract jar file and there is no image file !!!

  10. #10
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: problem in run code on eclipse(pulsar) !!!

    Did you add it to the build list, as I described above?

    Graham.

  11. #11
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    Open the "application descriptor" in the project, go to the "build" tab, and make sure that the file is included in the build.
    i cant find application descriptor !!! where is it ???

  12. #12
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: problem in run code on eclipse(pulsar) !!!

    If you're running Eclipse with the Mobile Jave Tools, and you created a MIDlet project, then the application descriptor should appear in the project explorer in the left-hand pane.

    Graham.

  13. #13
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    If you're running Eclipse with the Mobile Jave Tools, and you created a MIDlet project, then the application descriptor should appear in the project explorer in the left-hand pane.
    there is " src , res , J2ME library , deployed "

  14. #14
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: problem in run code on eclipse(pulsar) !!!

    Here's the instructions on how to create a project. See in the final picture, there is "application descriptor" in the project.

    Graham.

  15. #15
    Regular Contributor
    Join Date
    Aug 2009
    Location
    Iran - Tabriz
    Posts
    111

    Re: problem in run code on eclipse(pulsar) !!!

    you are rigth in eclipse pulsar there is application descriptor but in EclipseME there isn`t !!! i look buld tab there is 2 directory res and src and class but there is no image file !!!

Similar Threads

  1. Modules required :)
    By neil.young in forum Symbian
    Replies: 20
    Last Post: 2009-06-07, 11:35
  2. Error message while run a code
    By arashid in forum Symbian
    Replies: 3
    Last Post: 2006-11-24, 12:17
  3. Bluetooth problem in Symbian C++ code
    By vardhman in forum Bluetooth Technology
    Replies: 0
    Last Post: 2005-01-02, 08:17
  4. problem with Nokia Toolkit 3.1 and binary code for MMS
    By alinesimon in forum General Messaging
    Replies: 1
    Last Post: 2002-08-09, 06:40

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×