#NoClassDefFoundError

1 messages ยท Page 1 of 1 (latest)

still kettle
#

yoo, im using the JSONMessage Library from rayzr522 to make clickable messages. I added the library to my pom.xml and my IDE has imported the whole thing. But when i try to use the .send(player) method i get a java.lang.NoClassDefFoundError: me/rayzr522/jsonmessage/JSONMessage.

Any Idea how to fix it? Do i have to add anything to my plugin.yml?

Error code: https://pastebin.com/teYz6zJi

Regular code: https://pastebin.com/gewYcY58

Thanks in advance ๐Ÿ˜„

light spade
#

where does JSONMessage com from?

#

is that from a library you use?

still kettle
#

yes

light spade
#

are you using maven?

#

or gradle?

still kettle
#

sure

#

no maven

light spade
#

show your pom.xml pls

#

?paste

#

ugh doesn't work here

still kettle
still kettle
light spade
#

try to add

<scope>compile</scope>

to your dependency

light spade
#

oh and also

#

you DID compile your plugin using maven too, right?

#

like maven -> lifecycle -> package, yes?

#

you must compile your plugin using this

still kettle
#

i reloaded the whole thing via maven and im building my things via: build, build artefacts

light spade
#

yeah that's wrong

#

you MUST use maven to build

light spade
#

(double click on package)

still kettle
#

the one i selected? right

light spade
#

not compile

still kettle
#

ok and then it should work?
Do i also have to add: <scope>compile</scope> ?

light spade
#

it's not really needed but this will remind you that this actually gets shaded

#

it defaults to <scope>compile</scope> anyway

#

but I'd add it nonetheless

still kettle
#

ok where do i put it?

light spade
#

see where you have <scope>provided</scope> at the spigot part?

#

do the same to your json dependency, just replace provided with compile

still kettle
#

done โœ…

light spade
#

like this

still kettle
#

ill try it, gimme a sec ๐Ÿ˜„

light spade
#

now double click on package

#

your jar will be at <yourProjectFolder>/target/

still kettle
#

Do i have to run the package thing everytime i build a project? like updating things?

light spade
#

package is what creates the .jar for you

#

you never ever want to use Build -> Artifact or whatever again

#

instead you just double click package

#

"package" = the maven version of "build artifact"

still kettle
#

ok, is it the same folder with Build -> Build artifact

still kettle
#

[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /Users/jonah/Documents/Development/IdeaProjects/EssentialsJ/target/essentialsj-1.0-SNAPSHOT.jar with /Users/jonah/Documents/Development/IdeaProjects/EssentialsJ/target/essentialsj-1.0-SNAPSHOT-shaded.jar

light spade
#

does it say BUILD SUCCESS in a huge banner?

still kettle
#

yes

light spade
#

then it worked

#

/Users/jonah/Documents/Development/IdeaProjects/EssentialsJ/target/essentialsj-1.0-SNAPSHOT.jar

#

this is your final .jar

still kettle
#

the name of my file is essentialsj-1.0-SNAPSHOT.jar ?

light spade
#

yes

#

do you want to change the name?

still kettle
#

ok ill try it ๐Ÿ˜„

light spade
#

you can also change the output path

still kettle
#

on project structure ?

light spade
#

no no no

#

you will do everything related to dependencies, libraries, .jar stuff etc in your pom.xml

#

so you have the <plugins> section in your pom.xml, right? add this to it:

still kettle
#

i cant change the version in order to "rename" it right?

light spade
#
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <finalName>NameOfYourJarFile</finalName>
                    <outputDirectory>/Users/mfnalex/</outputDirectory>
                </configuration>
            </plugin>
#

do you want to include the version in your .jar name or not?

still kettle
#

yes, without the snapshot tho

light spade
#

then just go to the top of your pom.xml and replace 1.0-SNAPSHOT with 1.0

#

oh btw, another thing - you currently have your version in plugin.yml

#

we can make it so you only have to update it in the pom.xml and it automatically updates your plugin.yml

#

would you like to do that?

still kettle
#

yes show me ๐Ÿ™‚

light spade
#

alright, first open your plugin.yml

still kettle
#

that would be really nice ๐Ÿ‘Œ

light spade
#

instead of version: 1.0, use this:

version: ${project.version}
still kettle
#

aight

light spade
#

now, add this to your pom.xml:

#
<build>
    <resources>
      <!-- This tells Maven that it should "filter" all files in the resource directory. More on that later. -->
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>
#

it should be directly inside <project>

#

oh wait a second

#

I just see your project structure is messed up

#

your resources folder isn't at the correct place

#

on the right, you have a folder "src/main" right? right-click it, create new directory, then click on "resources" (it should be an automatic suggestion)

#

then move your plugin.yml to there

still kettle
#

can i also move /refactor the directory?

light spade
#

no

#

your new resources folder should look like this (see the small orange symbol?)

still kettle
#

those are my options

light spade
#

no no

#

right click on the "upper" main folder

#

this one

#

your structure is a bit messed up, normally maven does all this automatically when you create a new project

#

then it should suggest "resources"

still kettle
#

ah okay my structure is: src.java.de.jonah Do i have to create a new folder called main and then put everything below it and then create the new resource folder

light spade
#

oh yeah that's also wrong lmao

still kettle
#

xD

light spade
#

you know what

#

if you like

#

upload it to github

#

I'll fix it quickly

still kettle
#

the whole thing?

light spade
#

yes. do VCS -> Share on GitHub

still kettle
#

will do

light spade
#

thx

still kettle
#

thank you buddy ๐Ÿ™‚

light spade
#

can you give me write permission to the repository?
my github is "mfnalex"

#

I just see you're german

#

so we could also just speak german lol

still kettle
#

ok xD

light spade
#

although wait it's not allowed here on spigot

still kettle
#

i dont mind talkin english

#

wait ill join your dc

light spade
#

oki

still kettle
#

can you send me the link per dc? its not working somehow

light spade
#

5mins afk

still kettle
#

do you have a voice channel ?

light spade
#

nope but I don't have any mic rn anyway

#

brb

still kettle
#

ill share you my screen and then you can type where i have to add the perm.

#

or is it "Template repository"

light spade
#

one sec