Right click on project and select open module settings. Go to dependencies tab. click plus sign and add the module you want to use.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With