DEV Community

Discussion on: Question about importing Java packages. (too long to put in title)

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

the convention in Maven/Gradle
is to put your code in src/main/runtdeale/code/libs/org/json
and then yes you can import runtdeale.code.libs.org.json.*
although star imports are not really recommanded.
Just let your IDE import on the fly what's needed

Collapse
 
baenencalin profile image
Calin Baenen

Import runtdeale.code.libs.org.json.* from where? Main.java?
Would that still remain in the same relative directory to the library as I have it now?

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

imports are never relative

Which IDE are you using?

With IntelliJ IDEA Community Edition all this stuff is handled for you.

Thread Thread
 
baenencalin profile image
Calin Baenen

I'm using VSCode.
Also, what folder do I put the library in, then??

Collapse
 
baenencalin profile image
Calin Baenen

What's Maven and Gradle? Huh?

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard • Edited