Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use classes from another project in IntelliJ IDEA?

Tags:

People also ask

How do I use classes from another project in IntelliJ?

Right click on project and select open module settings. Go to dependencies tab. click plus sign and add the module you want to use.

Can we import class from another project?

Yes. In the Project Explorer right click on it and select Properties, there go to Java Build Path and select Projects tab. Add your other project here, now you're able to use the classes from it in your current project.

How do I import a class from another package in IntelliJ?

IntelliJ IDEA suggests to import single classes by default. You can change the settings to import entire packages instead. In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Editor | Code Style | Java | Imports. Clear the Use single class import checkbox, and apply the changes.

How do I import a class file into IntelliJ?

For the newer versions of Intellij, press Ctrl + Alt + Shift + s to open project settings, then choose Modules, under Dependencies tab choose the green + and add the folder in which your . class file is located. Under scope, choose compile.


I have two IntelliJ IDEA Java projects; ProjectA and ProjectB. I want to import and use code from ProjectA in ProjectB. How do I do this?

In Eclipse I would simply go to ProjectB's Build Path settings and add ProjectA.