#java.lang.NoClassDefFoundError: org/json/JSONObject

1 messages · Page 1 of 1 (latest)

swift cobaltBOT
#

<@&987246652869971988> please have a look, thanks.

swift cobaltBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

light bison
#

Did you build a fat jar or indicated the dependencies?

winter condor
#

if you are talking about the JSON dependencie

#

i just pasted that on the gradle.proprieties

#
dependencies {
  implementation group : 'org.json', name : 'json', version : '20220924'}
swift cobaltBOT
sullen jungle
#

That dependency is a seperate jar

#

so when you run your code that jar has to be on your classpath

digital flicker
#

jar by default only contains the code you wrote

#

it doesn't have your dependencies

#

you need to either have the dependency on classpath, or merge it into your jar

sullen jungle
digital flicker
#

there's a gradle plugin that does that

#

your jar ends up having both your .class files and their .class files

winter condor
#

how to put i on classpath?

digital flicker
#

instead of building with the build task, use the buildDist (cant remember the exact name) which creates a self-sufficient distribution and .bat/.sh files to run it

#

you need either the application plugin, or java, or both

winter condor
#

would that work?

digital flicker
#

oh look its minecraft again

winter condor
#

lmao

#

iam trying create json files but minecraft have no support for it

digital flicker
#

then you will need to shade the deoendency

winter condor
digital flicker
#

it has gson

#

included

#

if it's sufficient for your purposes, use it

winter condor
digital flicker
#

I'm not sure which version is this, but 1.19 definitely has it
it definittely has some sort of json library since it needs to parse datapacks somehow

#

1.16.5 also should have it

winter condor
#

that datapacks doenst allow

digital flicker
#

if you want configs, use the config API

winter condor
digital flicker
#

what does that mean

#

add hashmaps where

winter condor
#

i cant save configs like that

"minecraft:wither" = {
minions: "minecraft:creeper"
cooldown: 5
}
swift cobaltBOT
winter condor
#

configs api is just for simple stuff

#

just let me save List

#

or integers, bools etc

#

HashMap no

#

that is why i was trying use json

digital flicker
#

then create a datapack system for your mod

winter condor
#

i dont want

#

i want generate a json on config directory

winter condor
digital flicker
#

well then you're going against what other mod guys would tell you

#

and against common sense

winter condor
#

yes, so how do i shade the dependency?

digital flicker
#

dunno 🙂

winter condor
#

bruh

digital flicker
#

I dont want

winter condor
#

lol

#

bullshit, congrats

sullen jungle
#

i think you might be a bit lost

#

so you have a dependency in your gradle project

#

that needs to get bundled up into your code

#

right now you are building a jar that expects it to just be "provided by someone else"