473,625 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Same jar file does not run on different platforms

11 New Member
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\Che rryGame\>java -jar game.jar
Exception in thread "AWT-EventQueue-0" java.lang.Numbe rFormatExceptio n: For input string: ""
at java.lang.Numbe rFormatExceptio n.forInputStrin g(NumberFormatE xception.java:4 8)
at java.lang.Integ er.parseInt(Int eger.java:468)
at java.lang.Integ er.parseInt(Int eger.java:497)
at cherrygame.glob al.readConfigFo rStickProtectio n(global.java:2 060)
at cherrygame.nbCh erryGame.<init> (nbCherryGame.j ava:243)
at netbeansapplica tion.nbApplicat ion.<init>(nbAp plication.java: 46)
at netbeansapplica tion.nbApplicat ion$14.run(nbAp plication.java: 453)
at java.awt.event. InvocationEvent .dispatch(Invoc ationEvent.java :209)
at java.awt.EventQ ueue.dispatchEv ent(EventQueue. java:597)
at java.awt.EventD ispatchThread.p umpOneEventForF ilters(EventDis patchThread.jav a:273)
at java.awt.EventD ispatchThread.p umpEventsForFil ter(EventDispat chThread.java:1 83)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(EventDis patchThread.jav a:173)
at java.awt.EventD ispatchThread.p umpEvents(Event DispatchThread. java:168)
at java.awt.EventD ispatchThread.p umpEvents(Event DispatchThread. java:160)
at java.awt.EventD ispatchThread.r un(EventDispatc hThread.java:12 1)

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
3 3764
sateesht
41 New Member
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\Che rryGame\>java -jar game.jar
Exception in thread "AWT-EventQueue-0" java.lang.Numbe rFormatExceptio n: For input string: ""
at java.lang.Numbe rFormatExceptio n.forInputStrin g(NumberFormatE xception.java:4 8)
at java.lang.Integ er.parseInt(Int eger.java:468)
at java.lang.Integ er.parseInt(Int eger.java:497)
at cherrygame.glob al.readConfigFo rStickProtectio n(global.java:2 060)
at cherrygame.nbCh erryGame.<init> (nbCherryGame.j ava:243)
at netbeansapplica tion.nbApplicat ion.<init>(nbAp plication.java: 46)
at netbeansapplica tion.nbApplicat ion$14.run(nbAp plication.java: 453)
at java.awt.event. InvocationEvent .dispatch(Invoc ationEvent.java :209)
at java.awt.EventQ ueue.dispatchEv ent(EventQueue. java:597)
at java.awt.EventD ispatchThread.p umpOneEventForF ilters(EventDis patchThread.jav a:273)
at java.awt.EventD ispatchThread.p umpEventsForFil ter(EventDispat chThread.java:1 83)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(EventDis patchThread.jav a:173)
at java.awt.EventD ispatchThread.p umpEvents(Event DispatchThread. java:168)
at java.awt.EventD ispatchThread.p umpEvents(Event DispatchThread. java:160)
at java.awt.EventD ispatchThread.r un(EventDispatc hThread.java:12 1)

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
JosAH
11,448 Recognized Expert MVP
Exception in thread "AWT-EventQueue-0" java.lang.Numbe rFormatExceptio n: For input string: ""
at java.lang.Numbe rFormatExceptio n.forInputStrin g(NumberFormatE xception.java:4 8)
at java.lang.Integ er.parseInt(Int eger.java:468)
at java.lang.Integ er.parseInt(Int eger.java:497)
at cherrygame.glob al.readConfigFo rStickProtectio n(global.java:2 060)
at cherrygame.nbCh erryGame.<init> (nbCherryGame.j ava:243)
at netbeansapplica tion.nbApplicat ion.<init>(nbAp plication.java: 46)
at netbeansapplica tion.nbApplicat ion$14.run(nbAp plication.java: 453)
at java.awt.event. InvocationEvent .dispatch(Invoc ationEvent.java :209)
at java.awt.EventQ ueue.dispatchEv ent(EventQueue. java:597)
at java.awt.EventD ispatchThread.p umpOneEventForF ilters(EventDis patchThread.jav a:273)
at java.awt.EventD ispatchThread.p umpEventsForFil ter(EventDispat chThread.java:1 83)
at java.awt.EventD ispatchThread.p umpEventsForHie rarchy(EventDis patchThread.jav a:173)
at java.awt.EventD ispatchThread.p umpEvents(Event DispatchThread. java:168)
at java.awt.EventD ispatchThread.p umpEvents(Event DispatchThread. java:160)
at java.awt.EventD ispatchThread.r un(EventDispatc hThread.java:12 1)
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
muquaddim
11 New Member
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

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

Similar topics

3
5486
by: Romain | last post by:
Hello, I am writing out a binary file. I figured that the number "10" is automaticaly converted to "OD OA" instead of "OD". "OD" and "OA" are line feed and carriage return. I know it does that if the file is opened in something else than in binary mode. But in my example below, the file is really opened in binary.
1
1279
by: Jim | last post by:
Hello, I'm trying to read .zip files and drop from the listing those files that are directories. I'm using the zipfile module. Does anyone know how I can I tell which files in the .zip are directories? I have looked around the net for the information but I cannot make it out: the pkzip specification hints that it is in the "external file attribute" but also hints that it is dependent on the platform on which the .zip was made (I get...
15
10842
by: Sandra-24 | last post by:
Comparing file system paths as strings is very brittle. Is there a better way to test if two paths point to the same file or directory (and that will work across platforms?) Thanks, -Sandra
3
2488
by: darren | last post by:
Hi I have an assignment that is in C and, for an API call, asks for a uint_16 and uint_32 in one of its functions. In my C++ code i've been using uint16_t and uint32_t for fixed length integers. Are these two Types compatible? Also, if i make a struct of a few variables of type uint_xxx_t, can I
0
8259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8192
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.