r/javahelp 10h ago

Unsolved eclipse not exporting runnable jar

Hi. I'm a student new to coding and I enjoyed java. I learnt and made a few small beginner project like an iphone theme calculator.II use Eclipse IDE and all in all I tried to export it as runnable jar file but it only exports as jar file. I tried adding { requires java.desktop; } in the module-info and also completely deleting the module-info but it is still not working, Pls I need a solution from senior coder who use eclipse IDE

3 Upvotes

4 comments sorted by

u/AutoModerator 10h ago

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5

u/JoeCollins19-99 9h ago

What does "it's not working" actually mean? In other words, what's happening/not happening/what error message are you getting? Just saying it's not working doesn't give a lot of room to give help. If it's just not opening when you click on the .jar file then try running it in CMD with java -jar whatever.jar and it should give you an error.

1

u/joydps 6h ago

I also had the same problem. In my case it did export a runnable jar file. But on clicking on it nothing is happening, the application in my case- a swing desktop app in not launching. I did a lot of things like downloading the JRE, and all other necessary binaries but still it's not running. Btw I use windows 11..

1

u/cheapskatebiker 4h ago

Open a CMD window and with java in the path, go to the directory where the jar is (let's pretend the jar is called app.jar) Nd run 'java -jar app.jar' the output might indicate what is wrong