I'm sure that there is an article on here already about this, but I didn't see it.

I'm trying to make my java application executable so I can share it with friends but whenever I use eclipse to make it a jar or executable jar file and send it to them, but it sayts that it cannot find the main class when they try to run it.

Any ideas or revalations would be greatly appreciated, thanks.

Recommended Answers

All 4 Replies

have you tried to run your jar as an executable locally?
looks to me like you didn't point to the entrypoint (class containing the main method) in your manifest.mf file correctly.

I can share it with friends but whenever I use eclipse to make it a jar or executable jar file and send it to them, but it sayts that it cannot find the main class when they try to run it.

Any ideas or revalations would be greatly appreciated, thanks.

How are you invoking the java executable and how are you passing it the JAR file? Are you using the -jar switch? Do you have a Main-Class entry in the manifest file?

In eclipse just File/Export select Java/Runnable Jar, fill in all the blanks (including the name of the class that contains your main method) and that should be OK.

I have tried

File/Export select Java/Runnable Jar

and the normal jar in eclipse. I do make sure to include the main class every time, and it does work on my own computer and occasionally on another if I move it via flash drive

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.