i create a program using java and jframe. now how can i put it on desktop so that i dont have to keep on opening eciplse to run the program.

is there a way to put it on desktop with a icon. so i can click it any it will run without the eclipse.

Recommended Answers

All 2 Replies

You can jar it. lets say you had a program with package free. that means you have a free folder and inside it your class files. I'd navigate to the folder that contains the free folder, and type jar cvfm jarnameichoose.jar manifest.txt free

manifest.txt is a file you create that points to your main routine and i'm assuming you call it manifest.txt but it could be manifest.man or something else if you wanted. I don't have the doc on making a manifest but you should be able to google that or ask about it here.

Another option is just to make a .bat file in notepad. you could call it what you want if you give it the .bat extension. double click on a bat file and it runs the command you place in it like it was typed at the dos prompt. so you could put: java programname

in there. programname is the name of your java file that has the main class and you ommit its extension. You may need the full path to both the java command ( i.e. program files/java/jdk1.7.3/bin/java.exe or something and then whatever the path is to your java file.


You can do it easily in Eclipse.
Select your project then go to File -> Export... -> Runnable jar file
That takes you into a Wizard that will help you create a runnable jar file. You can double-click the jar file on the desktop to run your program (assuming Java is installed on the machine).

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.