I have made a HRMS (Human Resource management System) using NetBeans 6.5 and for database MySQL 5

The project is completed and running fine ( great) without any problem when i run it in NetBeans using Run Main Project Button.

Then i 'Clean and Build the project' and get a dist folder in thr project directory.

Now The PROBLEM IS...

When is run the jar file from the dist folder , the first form (i.e Splash From) Opens fine but after progress bar is filled it should be disappeared followed by opening of Login form , BUT it dont happen , the Login Form dont opens..

But It works fine when i run project from NetBeans and all forms opens.

when i run the jar file form dist folder using cmdPrompt the following errors shows .

Exception in thread "main" java.lang.NullPointerEXception
at javax.swing.ImageIcon.<init><unknown Source>
at hrms_project.Login_frame.<init><Login_frame.java:116>
at hrms_project.SplashPanel.main<SplashPanel.java:49>

Classes used in the project are

SplashPanel.java (jPanel)
Login_frame.java (jFrame)
user_pass.java (jFrame)
admin_pass.java (jFrame)

user_main_frame.java (jFrame)
admin_main_frame.java (jFrame)

admin_change_admin_pass.java (jPanel)
admin_change_emp_pass.java (jPanel)
emp_change_emp_pass.java (jPanel)

Main.java

where SplashPanel.java is set as main class to open first when project is run.

Do i also need to post the code?

Please Help !
I have my Project Presentation tomorrow..

Exception in thread "main" java.lang.NullPointerEXception
at javax.swing.ImageIcon.<init><unknown Source>
at hrms_project.Login_frame.<init><Login_frame.java:116>

How are you using the ImageIcon class on line 116? It looks like the program may not be finding the file. Are you using the getResource method to find and read the file? Is the file supposed to be in the jar file and not on the disk?

in declaration i have written

Image img =(new ImageIcon(getClass().getResource("/images/sirte_ico.jpg"))).getImage();

Then in jFrame properties >IconImage > Custom > and there in field i mentioned img

i had done this to set sirte_ico.jpg as icon for the frame ..
Is there anyother way to do so that i do not create exception or the image be in the jar file.

the folder images is in src folder of the project ..
then whats wrong

It will be better if you put the image files in the jar file and use the getResource methods to read them.

Reading a disk file from a jar file will require that the files all be in the correct locations. If they are in the jar file then you don't have to worry about that. They will always be where you put them in the jar.

how to keep image files in the jar file ?
and then how to use getResource methods to read them after that ?

Use the jar command to add files to a jar file.
There are lots of code samples that use getResource() on the forum. Do a Search for some of them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.