Java program runs on one computer but not on another?
I made a Java program on one of my three computers called Conversions. This is a very large program (.class file is 20kb) that uses the BreezySwing package to allow the user to convert values between different types of data types. If you are unfamiliar with Java simplification packages, you can read about BreezySwing here:
http://faculty.cs.wwu.edu/martin/Software%20Packages/BreezyGUI/Tutorial/breezygui_tutorial.htm
To make my program reliable to use, I created a batch file that would execute it and packaged it in a file folder that I could transport to other computers. The only thing I did not include in the file folder was a JDK download.
I was able to successfully copy the program to one of my other computers and have it run perfectly. There was only one minor problem with it. The problem was that during execution, Java would throw a NullPointerException error. However, the throwing of this error did not interfere with the functionality of the application; which still run fine. Both the design computer and the computer above had JDK version 7 installed.
Then I tried to put my program on a third computer (everything was exactly the same). However, when I attempted to run the application on this computer, Java throws a NullPointerException but does not allow the application to execute. In other words, the program does not work at all on this computer, it runs with runtime error on one, and runs perfectly on the original.
I find the problem very strange and I have no idea how to fix it. By commenting out certain parts of the source code of my program, I was able to determine that the error is being caused by the constructor, shown below:
//assume all variables have been declared before constructor
public Conversions(){
setTitle("Convert Application");
initialLbl = addLabel("Initial Value--->" ,1,1,1,1);
resultLbl = addLabel("Result--->" ,2,1,1,1);
initialFld = addDoubleField(0.00 ,1,2,1,1);
resultFld = addDoubleField(0.00 ,2,2,1,1);
convertBtn = addButton("CONVERT" ,3,2,1,1);
helpBtn = addButton("Help",4,2,1,1);
//repeated instantiation begins here...
tempLbl = addLabel("---Temperature---",6,1,1,1);
//begin placing temperature measures down rows
rbcelsius = addRadioButton("Celsius",7,1,1,1);
rbfahrenheit = addRadioButton("Fahrenheit",8,1,1,1);
rbkelvin = addRadioButton("Kelvin",9,1,1,1);
lengthLbl = addLabel("---Length---",10,1,1,1);
//begin placing length measures down rows
rbinch = addRadioButton("Inch",11,1,1,1);
rbmillimeter = addRadioButton("Millimeter",12,1,1,1);
rbfeet = addRadioButton("Feet",13,1,1,1);
rbyard = addRadioButton("Yard",14,1,1,1);
rbmeters = addRadioButton("Meter",15,1,1,1);
distLbl = addLabel("---Distance---",16,1,1,1);
//begin placing distance measures down rows
rbmile = addRadioButton("Mile",17,1,1,1);
rbkilometer = addRadioButton("Kilometer",18,1,1,1);
massLbl = addLabel("---Mass---",19,1,1,1);
//begin placing mass measures down rows
rbgram = addRadioButton("Gram",20,1,1,1);
rbounce = addRadioButton("Ounce",21,1,1,1);
rbpound = addRadioButton("Pound",22,1,1,1);
rbkilogram = addRadioButton("Kilogram",23,1,1,1);
NOTE: The entire constructor of my program is too large to place all of it here, so I have included most of it.
What is causing the problem with Java throwing NullPointerException? Is it the program syntax itself or is it the JDK or something else?
When I moved the application folder to the other computers, I changed everything to make sure that everything would work. If it was not correct, there would be a problem with the batch file; not the actual application. Therefore, I still have a problem.