Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| student:java:jar [2024/01/28 14:59] – bernstdh | student:java:jar [2025/10/15 15:08] (current) – bernstdh |
|---|
| ==== Creating an Executable JAR File ==== | ==== Creating an Executable JAR File ==== |
| |
| | You can create an executable JAR file by including a manifest that includes a ''%%Main-Class:%%'' directive. For more information, see the [[ http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html | tutorial ]]. |
| |
| An "executable JAR" file can be executed using the ''%%java%%'' tool with the ''%%-jar%%'' switch or, if the associations are set properly, by "clicking" on it. | The manifest can include a ''Class-Path'' entry that can contain external class files and jar files. FOr more information, see the |
| | [[https://docs.oracle.com/javase/tutorial/deployment/jar/downman.html | tutorial ]]. |
| |
| |
| |
| You can create an executable JAR file by including a manifest that includes a ''%%Main-Class:%%'' directive. For more information, see the [[ http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html | tutorial ]]. | |
| |
| ==== Running an Executable .jar File ==== | ==== Running an Executable .jar File ==== |
| - Open a command shell/terminal window. | - Open a command shell/terminal window. |
| - Change the working directory to the directory that contains the ''%%.jar%%'' file (using the [[https://ss64.com/|cd command]]) | - Change the working directory to the directory that contains the ''%%.jar%%'' file (using the [[https://ss64.com/|cd command]]) |
| - Execute the application as follows: ''%% java -jar //filename//.jar %%'' | - Execute the application as follows: ''java -jar //filename//.jar'' |
| |
| You can also run an executable .jar file from a file explorer/finder by double-clicking on it. However, your associations and permissions must first be setup. | You can also run an executable .jar file from a file explorer/finder by double-clicking on it. However, your associations and permissions must first be setup. |