How to create a .jar file properly?

1

I, who am totally new to Java, am trying to compile a project "Hello, World!" . I followed some Stack Overflow steps English. I followed all the steps, but when I open my jar, it gives error. I opened it, and I saw that it was the manifest's fault. I searched, but so far I have found no way to add the main class in the manifest. What should I do?

    
asked by anonymous 08.02.2014 / 11:20

1 answer

4

This is a very common question. The compilation of a manifest is external, using -m . In this case, for example, the steps would be:

  • javac HelloWorld.java - create .class
  • Create a .mf manifest with the following content: Main-Class: HelloWorld
  • Simply compile with tags jar cvmf manifesto.mf arquivo_jar_desejado.jar HelloWorld.class
  • < Oracle & Sun >

    < External >

    08.02.2014 / 12:04