How to create a JAR file (with pictures)

Table of contents:

How to create a JAR file (with pictures)
How to create a JAR file (with pictures)
Anonim

This article will show you how to create a Java archive, specifically a JAR file, using the free Java program Eclipse. This can be done on a Windows computer and Mac OS X.

Steps

Part 1 of 2: How to install the Eclipse program

Create JAR File Step 1
Create JAR File Step 1

Step 1. Make sure you have the Java Development Kit (JDK) installed

If there is no JDK on your computer, download and install it.

Create JAR File Step 2
Create JAR File Step 2

Step 2. Open the Eclipse website

Go to

If Eclipse is already installed, go to the next section

Step 3. Click on DOWNLOAD

It's a button at the top of the page.

Create JAR File Step 4
Create JAR File Step 4

Step 4. Click on DOWNLOAD

This orange button is at the top of the page that opens. Eclipse starts downloading to your computer.

Create JAR File Step 5
Create JAR File Step 5

Step 5. Wait until the download is complete

This will take some time.

Create JAR File Step 6
Create JAR File Step 6

Step 6. Run the Eclipse installer

  • On Windows double click on the downloaded file and then click “Yes” when prompted.
  • On Mac OS X double click on the downloaded archive (zip file) and wait for it to unpack.
Create JAR File Step 7
Create JAR File Step 7

Step 7. Open the Eclipse Installation Wizard window

To do this, double click on the purple Eclipse icon when it appears.

If you clicked on the “Change Mirror” link under the orange “DOWNLOAD” button, the Eclipse program itself may open. In this case, go to the "Click Browse" step

Create JAR File Step 8
Create JAR File Step 8

Step 8. Click Eclipse IDE for Java Developers

It's the top option in the Eclipse Installation Wizard window.

Create JAR File Step 9
Create JAR File Step 9

Step 9. Click Install

This yellow button is at the bottom of the window. The installation of Eclipse on your computer begins.

  • If you want, specify the folder where the program will be installed; to do this, click the folder-shaped icon to the right of the Installation Folder option, and then select a specific folder on your computer.
  • If you do not want to create shortcuts for Eclipse, first uncheck the corresponding options and then click Install.
Create JAR File Step 10
Create JAR File Step 10

Step 10. Click Launch

This green button is at the bottom of the setup wizard window. The Eclipse program will open.

Create JAR File Step 11
Create JAR File Step 11

Step 11. Click Browse

It's on the right side of the window. An Explorer (Windows) or Finder (Mac OS X) window opens.

Create JAR File Step 12
Create JAR File Step 12

Step 12. Select the workspace folder

Click on the desired folder on the left side of the screen. This folder will contain the Eclipse project files.

Create JAR File Step 13
Create JAR File Step 13

Step 13. Click on OK

It's in the lower-right corner of the window.

Create JAR File Step 14
Create JAR File Step 14

Step 14. Click Launch

You will find this option at the bottom of the window. The Eclipse home page will open.

Part 2 of 2: How to create a JAR file

Create JAR File Step 15
Create JAR File Step 15

Step 1. Copy the required files into one folder

The files to be placed in the JAR file must be in the same folder.

Create JAR File Step 16
Create JAR File Step 16

Step 2. Click on File

This menu is located in the upper-left corner of the window (Windows) or in the upper-left corner of the screen (Mac OS X). A dropdown menu will open.

Create JAR File Step 17
Create JAR File Step 17

Step 3. Click on Open File

It's near the top of the drop-down menu.

Create JAR File Step 18
Create JAR File Step 18

Step 4. Open the folder with files

Find the folder with the files you want, and then double-click the folder to open it. A list of files will be displayed on the screen.

Create JAR File Step 19
Create JAR File Step 19

Step 5. Select all files in the folder

Click on any file and then press Ctrl + A (Windows) or ⌘ Command + A (Mac OS X) to select all files in the folder.

Create JAR File Step 20
Create JAR File Step 20

Step 6. Click Open

It's in the lower-right corner of the window. The files will open in Eclipse.

Create JAR File Step 21
Create JAR File Step 21

Step 7. Click on File

A dropdown menu will open.

Create JAR File Step 22
Create JAR File Step 22

Step 8. Click Export

It's near the bottom of the drop-down menu.

Create JAR File Step 23
Create JAR File Step 23

Step 9. Double click on Java

It's near the top of the page.

Create JAR File Step 24
Create JAR File Step 24

Step 10. Click the JAR file

You will find this option under the "Java" option that you double-clicked on.

If you want the JAR file to run as a program, select the Executable JAR File option

Create JAR File Step 25
Create JAR File Step 25

Step 11. Click Next

This button is at the bottom of the window.

Create JAR File Step 26
Create JAR File Step 26

Step 12. Select assets to export

Check the boxes next to the unchecked resources that you want to add to your JAR file. Do this in the box at the top of the page.

Skip this step if you choose to create an executable JAR file

Create JAR File Step 27
Create JAR File Step 27

Step 13. Select a folder to store the JAR file

Click Browse, enter a filename, click the folder where the JAR file will be stored, and then click Save.

Create JAR File Step 28
Create JAR File Step 28

Step 14. Click Finish

The JAR file will be generated (it will take some time to compress the files).

Popular by topic