---
# System prepended metadata

title: Computer Programming II Pre-Lab 9
tags: [Computer Engineering, IUG, Computer Programming II, Pre-Lab]

---

---
title: Computer Programming II Pre-Lab 9
---
<h1 style='border: none'><center>Computer Programming II Pre-Lab 9</center></h1>
<h2 style='border: none'><center>How to Add a library in intelliJ</center></h2>
<h5><center>The Islamic University of Gaza<br>Engineering Faculty<br>Department of Computer Engineering</center></h5>
<h6>Authors: Usama R. Al Zayan<span style="float:right">2023/04/28</span></h6>
<h6>Parts of this Lab were adapted from work done by Mohammed Nafiz ALMadhoun and  Mohammed AlBanna</h6>
---

# [Add a library to module dependencies](https://www.jetbrains.com/help/idea/library.html#define-a-module-library)

Global and project libraries are not available until you add them to module dependencies.

1. From the main menu, select `File` -> `Project Structure` -> `Project Settings` -> `Modules`.
2. Select the module for which you want to add a library and click `Dependencies`.
3. Click the Add button (`+`) and select `Library`.

![](https://i.imgur.com/yXguVhN.png)


4. In the dialog that opens, select a project or a global library that you want to add to the module.

Alternatively, click New Library and select how do you want to add a new library: you can add a Java and Kotlin libraries from files on your computer, or download a library from Maven.

![](https://i.imgur.com/rtDiVsF.png)

References to module libraries are stored in the module .iml file. This file is used for keeping module configuration. For more information on module files, refer to [Modules](https://www.jetbrains.com/help/idea/creating-and-managing-modules.html).


# [Download a library from Maven](https://www.jetbrains.com/help/idea/library.html#download-libraries-from-maven)

1. From the main menu, select `File` -> `Project Structure` (`Ctrl`+`Alt`+`Shift`+`S`) and click `Libraries`.
2. Click Add (`+`) and select From `Maven`.
3. In the next dialog, specify the library artifact (for example, `org.openjfx:javafx-web:18`). If you don't know its exact name, enter the key words and click Search.

You can also specify another library location, and select whether you want to download transitive dependencies, source files, Javadoc files, or annotations.

![](https://i.imgur.com/QUNO74G.png)

4. Add `requires javafx.web;` to `module-info.java` file.


![](https://i.imgur.com/zNkBWAb.png)


# Maven dependencies
For more information about [Maven dependencies](https://www.jetbrains.com/help/idea/work-with-maven-dependencies.html).

###### tags: `Computer Programming II` `Pre-Lab` `IUG` `Computer Engineering`

<center>End Of Pre-Lab 9</center>