Runnable jar file generated by Eclipse wont execute?

前端 未结 3 1224
长发绾君心
长发绾君心 2020-12-18 10:45

I generated a very simple runnable jar file using Eclipse\'s \"Export-->Java-->Runnable Jar File\" function. My HelloWorld class looks like this:

import ja         


        
相关标签:
3条回答
  • 2020-12-18 11:05

    In my case, by mistake I had not declared the class containing public static void main() as a public class. After declaring the class as public was able to resolve this issue with the next export as runnable jar via eclipse...

    Hope this helps...

    0 讨论(0)
  • 2020-12-18 11:06

    Uninstalling all older java versions on my machine fixed the issue for me.

    At my end I was able to run the .jar file with the command line, but not with the default double-click option. Afterwards the latter was working again

    0 讨论(0)
  • 2020-12-18 11:27

    Jars are never 'executable' in this sense. What this jar is good for is:

    java -jar YOURJAR.jar
    

    update the backtrace you supplied is bizarre. It appears that Windows decided to go ahead and launch your jar with some version of Java, but pass it a pathname in the place of a class name. I don't know what the story is with that.

    0 讨论(0)
提交回复
热议问题