NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
Fatimah
Joined: 28 Nov 2011 Posts: 3
|
Posted: Mon Nov 28, 2011 9:07 am Post subject: trying to run my java code |
|
|
good day all,
I am trying to run my java code and it works only in my pc.
if I try to run it in different pc using the jar file it won't work!!
can any one help me please??? |
|
| Back to top |
|
 |
lvskiprof
Joined: 19 Jul 2011 Posts: 49 Location: Las Vegas, NV
|
Posted: Mon Nov 28, 2011 7:07 pm Post subject: Re: trying to run my java code |
|
|
How are you trying to run it on the other system? What error are you seeing?
You probably need to set up you CLASSPATH environment variable so that the required libraries are there for Java to find.
By default Netbeans copies all dependent libraries into a lib directory under the dist directory where it places your jar file. The MANIFEST file it creates tells it to look for dependent jar files in a lib directory under the directory you run it from. Adding the lib file to your jar should work, or creating a lib directory under where you run the jar from with all the required jar files in it, will also work.
I have been using the last option for my Selenium programs, because adding the lib directory to every jar file just means I have the same files copied into every Selenium test program I write.
Mike
| Fatimah wrote: | good day all,
I am trying to run my java code and it works only in my pc.
if I try to run it in different pc using the jar file it won't work!!
can any one help me please??? |
|
|
| Back to top |
|
 |
Fatimah
Joined: 28 Nov 2011 Posts: 3
|
Posted: Mon Nov 28, 2011 11:22 pm Post subject: Re: trying to run my java code |
|
|
I took the dist folder as it is containing the jar file and the lib folder.
I did not receive any kind of errors but the button that works well in my system stop working in other systems.
specifically this button using a class I wrote by my self.
other buttons working well (cancel --> close the window and ends the execution -browse--> navigates the files and folders)
| lvskiprof wrote: | How are you trying to run it on the other system? What error are you seeing?
You probably need to set up you CLASSPATH environment variable so that the required libraries are there for Java to find.
By default Netbeans copies all dependent libraries into a lib directory under the dist directory where it places your jar file. The MANIFEST file it creates tells it to look for dependent jar files in a lib directory under the directory you run it from. Adding the lib file to your jar should work, or creating a lib directory under where you run the jar from with all the required jar files in it, will also work.
I have been using the last option for my Selenium programs, because adding the lib directory to every jar file just means I have the same files copied into every Selenium test program I write.
Mike
| Fatimah wrote: | good day all,
I am trying to run my java code and it works only in my pc.
if I try to run it in different pc using the jar file it won't work!!
can any one help me please??? |
|
|
|
| Back to top |
|
 |
lvskiprof
Joined: 19 Jul 2011 Posts: 49 Location: Las Vegas, NV
|
Posted: Tue Nov 29, 2011 6:01 pm Post subject: Re: trying to run my java code |
|
|
I am going to assume that you see the jar file for your class in the lib subdirectory. But check to see if the jar files in the lib subdirectory for that class are also in there, in case it has some dependencies that did not get copied into the lib directory for your project.
The other possibility that I can think of would be that this other system might not have some library installed on it that you have on your development system.
But all those cases would generate an exception saying that a class couldn't be found. If you are not seeing that error then something else is going on, in which case you will probably have to do some debugging on the system where it is failing to run properly.
Mike
| Fatimah wrote: | I took the dist folder as it is containing the jar file and the lib folder.
I did not receive any kind of errors but the button that works well in my system stop working in other systems.
specifically this button using a class I wrote by my self.
other buttons working well (cancel --> close the window and ends the execution -browse--> navigates the files and folders) |
|
|
| Back to top |
|
 |
Fatimah
Joined: 28 Nov 2011 Posts: 3
|
Posted: Fri Dec 02, 2011 1:13 pm Post subject: |
|
|
is it matter if I use win 7 and try to run the code in vista ????!!
couz now I am receiving this message
"could not find the main class. program will exit." |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|