1

I have two class files HelloViewer.class and HelloComponent.class. I want to make it so when you run the jar it uses HelloViewer.class as the entry point. At the moment im using.

jar cfe Hello.jar main HelloViewer.class *.class

and i have also tried

jar cfe Hello.jar HelloViewer.class HelloViewer.class HelloComponent.class

i'm rather confused by this.

Danny Bentley
  • 60
  • 2
  • 9
  • 2
    The syntax is `jar cfe [jar-name] [entry-point] [files to include]`. In your case: `jar cfe Hello.jar HelloViewer *` – Turing85 May 07 '15 at 18:45

1 Answers1

1

Canonical answer is at https://docs.oracle.com/javase/tutorial/deployment/jar/appman.html

Briefly:

Make a file Manifest.txt

Give it the content Main-Class: HelloViewer (note that this should be the fully-qualified name of the class).

Then tell jar that it's the manifest by using the m argument:

jar cfm Hello.jar Manifest.txt *.class
Dathan
  • 7,266
  • 3
  • 27
  • 46