Showing posts with label jar. Show all posts
Showing posts with label jar. Show all posts

Saturday, July 23, 2011

How to convert JAR files to EXE files

Hello All :)


How are you all :) 


Well in this post i will be providing your softwares and steps to convert your JAR file to EXE file


This post will give you brief steps to convert you jar to exe file


Lets begin ;)


But before we begin let me show you the code and the jar file first. Below is the screenshot of the code and the jar file icon on the desktop




Code that creates a frame and adds 3 button in a Flow Layout style




This is the Frame.jar of the above code


Steps:
NOTE: My jar file name is Frame.jar 

1. Open notepad and type start javaw -jar <your jar file name>.jar and save it as <anything>.bat. Below is my Frame.bat file content


 2. Now download this file Click Here and unzip this file and open Bat_To_Exe_Converter.exe. Below frame will be displayed


Select the .bat file that you created and give the file name and path of your exe file 

It is optional to add the version etc. after completing this click on compile

3. Congrats your exe file is ready to use :) :) 


Thats it for this post


Take Care


Peace




For Any Query mail me: ravjot.singh.28@gmail.com

Tuesday, June 28, 2011

Creating Jar file Using CMD/Terminal

Hello Friends :)


Well i will not provide u the basics of Java coz we all are smart programmers, I will touch areas which are essential for programming but at the same time we don't have sufficient resources to get solution.


My First topic will be to create a jar File


How to create a Jar file? ( very common question )


Well many of us use IDEs (Netbeans or eclipse) to create jar files which is the easiest method.


But there are various tricks in which we have to create jar files manually ( these tricks will be provided in future posts NOT TO WORRY :) ) & for starters this is the best place to learn to create jar files using cmd/terminal 

Steps are as follows

1. Make a folder and in that folder compile your .java files. [let the folder location be C:/../Desktop/x]

2. Now after successful compiling the .java files open your notepad and type in it

Main-Class: <your .java file name which u want to run when you run jar file> <Note:press enter after this line>

[optional] Class-Path: <if you are using any library write them here and separate file name with space> <Note:press enter after this line>


  
Eg:  Suppose my main java file name is “main.java” and i am using three libraries “c.jar lib/a.jar lib/b.jar” . So my notepad will contain

Main-Class: main    <Note:press enter after this line>

Class-Path: lib/a.jar lib/b.jar c.jar <Note:press enter after this line>

Save as the file “main.mf” at the location “C:/../Desktop/x/main.mf”

3.  Now open your cmd/terminal and type in it cd C:/../Desktop/x press enter

4. Now type the command “jar cvfm <your jar file name>.jar main.mf *.class” and press enter

5. Thats it in 4 steps you created your jar file congrats to all :)


Thats it for this post
Enjoy
Keep smiling
Have fun 





For Any Query mail me: ravjot.singh.28@gmail.com