Packaging & jar
(source)
- The various files from the application can be grouped together into an 'archive' file created with the
jar
tool:
javac chap2/*.java # compilation
java -cp . chap2.Group # run
jar cvf groups.jar chap2/*.class # create archive
java -cp groups.jar chap2.Group # run with archive
- 'c' creates a new archive (with all the classes *.class)
- 'f' specifies the archive name (here groups.jar)
- 'v' uses the verbose mode
- It is possible to select a main executable:
jar cvfe groups.jar chap2.Group chap2/*.class
java -jar groups.jar
The last command is used to execute a jar file when clicked on it for instance.
12 - 14Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented
Java jva jav laurent thiry uha enseignant ensisa ecole school national alsace programmation objet approche mulhouse france java object programming oriented