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
Next revisionBoth sides next revision
student:java:jar [2022/09/04 08:47] bernstdhstudent:java:jar [2023/09/04 16:19] bernstdh
Line 1: Line 1:
- 
- 
 ===== The Java Archive Tool (jar) ===== ===== The Java Archive Tool (jar) =====
  
Line 50: Line 48:
 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 ''%%chmod%%'') or from the GUI  (in a variety of different ways).
  
 +==== Associations and Executable .jar Files ====
  
-You may also need to set the default manner in which it is  "opened" (i.e., instruct the OS to used the Java runtime). This is  sometimes also called the files "association" or "default  program". From the command line: in MS Windows you can  use ''%%assoc%%'', is OS X you can edit  ''%%~/Library/Preferences/com.apple.launchservices.plist%%'',  and in Linux you can edit  ''%%/usr/share/applications/defaults.list%%'' From the GUI:  in MS Windows you can click on <key>Start</key>+<key>Default  Programs</key>, in OS X you can right-click on the file and  use <key>File</key>+<key>Get Info</key>, and in Linux you  can right-click and select <key>Properties</key>+You may also need to set the default manner in which it is  "opened" (i.e., instruct the OS to used the Java runtime). This is  sometimes also called the files "association" or "default  program". From the command line: in MS Windows you can  use ''%%assoc%%'', in OS X you can edit  ''%%~/Library/Preferences/com.apple.LaunchServices.plist%%'',  and in Linux you can edit  ''%%/usr/share/applications/defaults.list%%'' From the GUI:  in MS Windows you can click on <key>Start</key>+<key>Default  Programs</key>, in OS X you can right-click on the file and  use <key>File</key>+<key>Get Info</key>, and in Linux you  can right-click and select <key>Properties</key>.
  
 ==== Testing an Executable .jar File ==== ==== Testing an Executable .jar File ====
Line 67: Line 66:
 </code> </code>
  
-it means that you need to update your version of Java. When doing so, you need to be careful because many systems have both the Java Runtime Environment (JRE) and the Java Development Kit (JDK) installed, and updating the one may not update the other. In Linux/OSX you can use %% which java%% and in MS-WIndows you can use %%where java%% to find the path to the Java interpreter. You can change the %%path%% environment variable (not the %%classpath%% environment variable) to change which Java interpreter is used (i.e., either the one installed with the JRE or the one installed with the JDK).+it means that you need to update your version of Java. When doing so, you need to be careful because many systems have both the Java Runtime Environment (JRE) and the Java Development Kit (JDK) installed, and updating the one may not update the other. In Linux/OSX you can use ''%%which java%%'' and in MS-WIndows you can use ''%%where java%%'' to find the path to the Java interpreter. You can change the ''%%path%%'' environment variable (not the ''%%classpath%%'' environment variable) to change which Java interpreter is used (i.e., either the one installed with the JRE or the one installed with the JDK).
  
 ==== Using Resources in a .jar File ==== ==== Using Resources in a .jar File ====