By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 769 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Same jar file does not run on different platforms

P: 11
Hi,
First of all I am not a java programmer. what I am doing is just trying to port a precompiled game to other machine.
I have a java game project. the final output or the game is "game.jar". I compiled this in fedora with netbeans (5.5.1) ide. It was running well in fedora.
But The problem arises when I try to run that same jar file from windows with same command. I used same jdk in both linux and windows.
when I run it from fedora
# java -jar game.jar
works ok
but in windows
C:\src\java\CherryGame\>java -jar game.jar
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Num berFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:497)
at cherrygame.global.readConfigForStickProtection(glo bal.java:2060)
at cherrygame.nbCherryGame.<init>(nbCherryGame.java:2 43)
at netbeansapplication.nbApplication.<init>(nbApplica tion.java:46)
at netbeansapplication.nbApplication$14.run(nbApplica tion.java:453)
at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 597)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)

I use the same directory structure in both linux and windows. in fact I use the same jar file all the time. the source tree is accessible in both linux and windows.

Can anyone tell me how to make it run successfully?
I am stuck.
Sep 13 '07 #1
Share this Question
Share on Google+
3 Replies


P: 41
Hi,
First of all I am not a java programmer. what I am doing is just trying to port a precompiled game to other machine.
I have a java game project. the final output or the game is "game.jar". I compiled this in fedora with netbeans (5.5.1) ide. It was running well in fedora.
But The problem arises when I try to run that same jar file from windows with same command. I used same jdk in both linux and windows.
when I run it from fedora
# java -jar game.jar
works ok
but in windows
C:\src\java\CherryGame\>java -jar game.jar
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Num berFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:497)
at cherrygame.global.readConfigForStickProtection(glo bal.java:2060)
at cherrygame.nbCherryGame.<init>(nbCherryGame.java:2 43)
at netbeansapplication.nbApplication.<init>(nbApplica tion.java:46)
at netbeansapplication.nbApplication$14.run(nbApplica tion.java:453)
at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 597)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)

I use the same directory structure in both linux and windows. in fact I use the same jar file all the time. the source tree is accessible in both linux and windows.

Can anyone tell me how to make it run successfully?
I am stuck.


Hi,

Java is a Platform independent Language, moreover Jar contains only class files, and Java itself says that "Write Once Run Any where " so it has to be executed, and moreover you have written this source code and compiled it using the Tool , please cross check whether there are any tool specific xml files are there for configuration, if that is the case you are unable to execute the code.

Cheers,
Sateesh.
Sep 14 '07 #2

Expert 10K+
P: 11,448
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Num berFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:468)
at java.lang.Integer.parseInt(Integer.java:497)
at cherrygame.global.readConfigForStickProtection(glo bal.java:2060)
at cherrygame.nbCherryGame.<init>(nbCherryGame.java:2 43)
at netbeansapplication.nbApplication.<init>(nbApplica tion.java:46)
at netbeansapplication.nbApplication$14.run(nbApplica tion.java:453)
at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 597)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)
From what I see in that stack trace the game is trying to read some configuration
data. Are you sure you packed the correct config data with the .jar? Maybe the
game is reading from other config data when run in fedora.

kind regards,

Jos
Sep 14 '07 #3

P: 11
Hi,

Java is a Platform independent Language, moreover Jar contains only class files, and Java itself says that "Write Once Run Any where " so it has to be executed, and moreover you have written this source code and compiled it using the Tool , please cross check whether there are any tool specific xml files are there for configuration, if that is the case you are unable to execute the code.

Cheers,
Sateesh.
actually I compiled it with netbeans 5.5.1
netbeans uses ant as backend as far I found in forums. then I compiled it by ant.
#ant -buildfile build.xml
my build file is here, I omitted the comments

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="NetBeansApplication" default="default" basedir=".">
  3.     <description>Builds, tests, and runs the project NetBeansApplication.</description>
  4.     <import file="nbproject/build-impl.xml"/>
  5.     <target name="-post-jar">
  6.         <jar update="true" destfile="${dist.jar}">
  7.             <zipfileset src="${libs.swing-layout.classpath}"/>
  8.             <zipfileset src="${libs.addMoney.classpath}"/>
  9.             <zipfileset src="${libs.NormalWindow.classpath}"/>
  10.         </jar>
  11.     </target>
  12. </project>
  13.  
Sep 14 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.