If I have a package called runtdeale.code
in the folder RuntDeale/resources/code
, could I do import runtdeale.code.libs.org.json.*;
to import the JSON library, which is a package below my original package?
Filesystem:
RuntDeale:
resources:
textures: ...
...
code:
Main.java
manifest.txt
...
libs:
org:
json:
/* org.json library files */
Top comments (6)
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
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?
imports are never relative
Which IDE are you using?
With IntelliJ IDEA Community Edition all this stuff is handled for you.
I'm using VSCode.
Also, what folder do I put the library in, then??
What's Maven and Gradle? Huh?
A build system for Java - and Kotlin
docs.gradle.org/current/userguide/...
docs.gradle.org/current/samples/sa...