Member Avatar for arcticM

Hello everybody.
I'm a beginner and I need your help.
I have a GUI programme and I need to make it run from an icon on the desktop. can you help me with an easy way to do so?

Recommended Answers

All 3 Replies

You put your class files into a jar file along with an extra file called a manifest in which you specify which class's main method you want to start with. The jar file can then be double-clcked to run the program.
There's loads of info on the web, now you know what to look for.

Member Avatar for arcticM

I created manifest.txt
inside it says "Main-Class: MainGui
"
(MainGui is the name of my main class) and I put the txt file into the project folder.
then I created jar file (I didn't understand any other way that was suggested on the web to do it ,so I went "File->export->jar file..etc) and I checked the box to include the manifest.txt
but when I click on the jar file on my desktop I only hear an error sound! I guess I did something wrong.
I still don't understand what I'm doing, for example how would it know that the manifest.txt has the info about which class is main? I've got another txt files in the folder..

Try running it with java -jar myjarfile.jar so you can see the error message(s)
ps:It knows to look in the manifest file because the name of that file is hard-coded into the java runtime.

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.