Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
student:java:jar [2024/01/28 14:57] bernstdhstudent:java:jar [2025/10/15 15:08] (current) bernstdh
Line 35: Line 35:
 ==== 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 orif 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 informationsee 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 ====
Line 47: Line 46:
  
   - 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.
Line 54: Line 53:
 ===== Permissions and Executable .jar Files ===== ===== Permissions and Executable .jar Files =====
  
-Depending on your operating system, you may need to change the  permissions of the executable ''%%.jar%%'' file (i.e.,  provide permission to execute). In most OSs this can be done from  the command line (using ''%%chmod%%'') or from the GUI  (in a variety of different ways).+Depending on your operating system, you may need to change the  permissions of the executable ''%%.jar%%'' file (i.e.,  provide permission to execute). In most OSs this can be done from  the command line (using the  [[https://ss64.com/|chmod command]]) or from the GUI  (in a variety of different ways).
  
 ===== Associations and Executable .jar Files ===== ===== Associations and Executable .jar Files =====