Current Position:Home > Application works from NB but not from jar

Application works from NB but not from jar

Update:10-11Source: network consolidation
Advertisement
Hi,
I'am programming a game in JAVA and this going as planned. Everything works when I run it from NetBeans, but when I execute the jar file from the console, then I get hunderds of the same exception.
I really don't know what it is, I see a NoSuchMethod exception in the MouseEvent of the method getLocationOnScreen(), but just as i said, the app works fine without errors from out NB.
Does somebody knows what the problem is?
thx Sven
java -jar Hotel.jar
Loading board images.
Loading image: /Images/bg-patern-hotel.jpg
Opening file /Images/bg-patern-hotel.jpg file exisits: true -- [/Users/svenvanzoelen/NetBeansProjects/Games/Hotel/dist/Images/bg-patern-hotel.jpg]
Loading image: /Images/Main-board-big.jpg
Opening file /Images/Main-board-big.jpg file exisits: true -- [/Users/svenvanzoelen/NetBeansProjects/Games/Hotel/dist/Images/Main-board-big.jpg]
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: java.awt.event.MouseEvent.getLocationOnScreen()Ljava/awt/Point;
     at Engine.GameAction.setMousePos(GameAction.java:137)
     at Engine.InputManager.mouseMoved(InputManager.java:277)
     at java.awt.Component.processMouseMotionEvent(Component.java:5647)
     at java.awt.Component.processEvent(Component.java:5371)
     at java.awt.Container.processEvent(Container.java:2010)
     at java.awt.Window.processEvent(Window.java:1184)
     at java.awt.Component.dispatchEventImpl(Component.java:4068)
     at java.awt.Container.dispatchEventImpl(Container.java:2068)
     at java.awt.Window.dispatchEventImpl(Window.java:1801)
     at java.awt.Component.dispatchEvent(Component.java:3903)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
     at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Same error goes 50 times more.Edited by: Svenmeister on Apr 16, 2010 7:22 AM
Edited by: Svenmeister on Apr 16, 2010 7:22 AM

The Best Answer

Advertisement
Ok, I updated my Mac but still got the 1.5.0_22 crap so I changed the function from the mouseEvent to one that 1.5 supports.
But now when I run the application from the console the Exception about the mouse function is gone, but I got another exception instead of it. And this one is I believe not JRE version relevant.
The error is in the loading of the images, at the third PNG image to be precise. The images are now in total 10.8MB in size.
So is this also a 1.6 thing? Would be awesome if someone can explain it.
java -jar Hotel.jar Loading board images.
Exception in thread "Image Fetcher 0" java.lang.OutOfMemoryError: Java heap space
     at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)
     at java.awt.image.Raster.createPackedRaster(Raster.java:458)
     at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
     at sun.awt.image.ImageRepresentation.createBufferedImage(ImageRepresentation.java:223)
     at sun.awt.image.ImageRepresentation.setPixels(ImageRepresentation.java:469)
     at apple.awt.OSXImageRepresentation.setPixels(OSXImageRepresentation.java:66)
     at sun.awt.image.ImageDecoder.setPixels(ImageDecoder.java:120)
     at sun.awt.image.PNGImageDecoder.sendPixels(PNGImageDecoder.java:498)
     at sun.awt.image.PNGImageDecoder.produceImage(PNGImageDecoder.java:419)
     at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:246)
     at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
     at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
     at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)
     at java.awt.image.Raster.createPackedRaster(Raster.java:458)
     at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
     at java.awt.image.BufferedImage.<init>(BufferedImage.java:345)
     at apple.awt.CGraphicsConfig.createCompatibleImage(CGraphicsConfig.java:174)
     at GUI.Board.toBufferedImage(Board.java:1472)
     at GUI.Board.loadImages(Board.java:1143)
     at Engine.HotelMain.switchState(HotelMain.java:86)
     at Engine.HotelMain.<init>(HotelMain.java:57)
     at Engine.HotelMain.main(HotelMain.java:194)Edited by: Svenmeister on Apr 16, 2010 11:01 AM
  • I am using a Application in c dll calling from jni jar by java applet in firefox version 19.0 , the problem is click event message box will not working correct Update:11-30

    I am using a Application in c dll calling from jni jar by java applet in firefox version 19.0 , the problem is button click event message box or popup window will not working correctly. Please any one suggest me the steps to overcome this not respond

  • Application works from NB but not from jar Update:10-11

    Hi, I'am programming a game in JAVA and this going as planned. Everything works when I run it from NetBeans, but when I execute the jar file from the console, then I get hunderds of the same exception. I really don't know what it is, I see a NoSuchMe

  • Application in j2sdk1.4.1 to open jars Update:10-11

    I recently have started using the command line to compile and run my Java programs instead of an IDE. In the directory where I keep my source files and .class files, I accidentally changed the "opens with" program for jar files and I don't remem

  • The jar size value in the Application Descriptor does not match the real ja Update:10-11

    Hi, when i creat obfuscated package for my application It's posing the Error preverifying class A Class loading error: Wrong name The jar size value in the Application Descriptor does not match the real jar file size. It's perfectly working for all t

  • How can execute a jar application Update:10-11

    Hello there, I am facing problem with executing jar application. How can I execute a jar application using java program. Thanks & RegardsVINAY_Kr_SHARMA wrote: ...How can I execute a jar application using java program.Do you mean: a) You have a Java

  • Including extensions in my application JAR Update:11-30

    Hi. I have an application in a JAR-file the uses some extension classes also found in a JAR-file. To run my application I have to put the extension JAR-file in ...\JavaSoft\JRE\1.3.1\lib\ext\. I would like to be able to distribute my application in a

  • My ejb application can't see jar files Update:11-30

    I am using JBoss 2.4.3 as my EJB server. I have followed the instructions in the documentation about making jar files visible to my ejb application. ie, I have an ear file with the following contents: meta-inf/application.xml meta-inf/Manifest.mf myE

  • Application jar path?? Update:11-30

    Hi all: I have the following situation: We're writting an application where all the class files are jar'ed together. We're supplying html help with the application. The file structure will look like this after installation: appDirectory - app.jar - h

  • Where can I find the jar files of the application I have deployed? Update:11-30

    If I deploy an J2EE application successfully on NetWeaver, where are the jar files located? How to find them?Hi Luc, APEX does not create physical file that is in APEX_APPLICATION_FILES table. It can only store the file in BLOB format in repository.

  • Problem in run the Java ME application using jar file Update:11-30

    Hi all, I am using Eclipse 3.3 with CLDC and MIDP, I add external jar file for my application. The jar contains MIDlet and some classes. I create a class (not MIDlet) that have same package name and Class as in jar file. Say for example the jar file