Friday, April 22, 2011

How to make JAR files using NetBeans IDE

These steps will allow you to create java executable that will run just by double clicking the file.
»Create JFrameForm with GUI swing components in a project in NetBeans IDE or Open a existing one.
»Run the file to check for any errors(Shift + F6).
»Now in the source code find the line public static void main(String args[]) {

» Copy the text under it till its closing brace.
» Now open the main class of the package in which the JFrameForm lies.
» In the main class find the same line as earlier and paste the text below it.
» Now Clean and build your main project
» Now locate the file (mostly in the dist folder of the Project).
» Double click the file to see it running.......!!!

                       //You can see a video tutorial for this on Videos Page
If this post helped you, just give your few seconds for sharing it and let others be helped too.

6 comments:

  1. i created a jar file of my j fram using
    http://www.youtube.com/watch?v=LF5cLVivV_Y

    and got the error:
    Java Virtual Machine Launcher:
    Could not find the main class:****.Program will exit
    please help me with it
    also i am a school student and a beginner so please explain in simple language

    ReplyDelete
  2. i created a jar file of my j fram using
    http://www.youtube.com/watch?v=LF5cLVivV_Y

    and got the error:
    Java Virtual Machine Launcher:
    Could not find the main class:****.Program will exit
    please some one help me with it
    also i am a school student and a beginner so please explain in simple language

    ReplyDelete
  3. @utsav You are in 11th or 12th?

    Are your files are placed in 'default package' , if yes create a new package and move your frame and main class to it using refactor.

    If still the problem persist,
    » Update your JRE to latest version
    » Ensure that there were no errors at compile time an try rebuolding your project

    ReplyDelete
  4. the program is databe dependent in the case how to build jar file

    ReplyDelete
  5. YOu are the best.Your java works.thank you, they really helped me with my final year project since l'm new in java.

    can you please help me with my search engine.l want the code to display the search results from the database into a text field after pressing the search button.

    please help me.l have limited time to submit my final project.

    thank you for your assistance

    ReplyDelete