Multiple key

Hello, I have a problem, I have an error : IllegalArgumentException

I think the plugin load the same classe two times
Sorry I’m french I don’t know how to speak english it’s my limit but if you can help me

build.gradle :
https://pastebin.com/f2AykiHs

MainClass :
https://pastebin.com/4FJycfd4

How are you compiling your java code? Through gradle? Or through “export jar”/“build artifact”?

I have try two :

  • If I export I have this error
  • If I build with gradle it say don’t have tools.jar

What ide are you using?

Make sure your not compiling sponge with your plugin. You can check this by opening your plugin in a zip file explorer and checking for sponge file.

Ive downloaded your main and compiled it myself. It works fine.

If you dont have a zip opener on your pc and your on windows 7 or better, you can change your plugins file extension from .jar to .zip and then double click it

I don’t find any document with sponge but what is “bin” because we saw in the error what same keys are read and in the zip There are the Main of the folder fr/neroz etc… with Main class but too in bin have the Main class so perhaps the two class load ?

The bin folder within your project folder are the compiled classes. You may notices that the file extension of the files your writing to are .java while the file extentions in the bin folder are .class.

Just to clarify. The sponge file will not in the bin nor the src folder. They will only be in the compiled .jar folder.

And what is your IDE? Intelij IDEA? Eclipse? Netbeans?

My IDE is eclipse and the two files is .class but why when I build it write : java.lang.IllegalStateException: Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_231 contains a valid JDK installation.

jre1.8.0_231 is a folder not a jar I say to me it is a possible reason ?

I do research and I have found of tools.jar is missing on some versions

Right. So your getting IlligalStateException because your not pointing eclipse to a JDK (Java Development Kit - used for building .jar files). Instead you eclipse is pointing to a JRE (Java Runtime Environment - used for running .jar files). Eclipse has a built in JDK which it is why you can still make the files.

How can I change the directory I have already search that but I don’t found if you can say me

A quick google search got me the answer

So put your jdk in like that. Make sure its either jdk 8 or set to compile in jdk 8

I have put the jdk it is the jdk1.8.0_231 But I don’t understand why when I build it say the same thing it found the jre but in the package explorer she show jdk at “jre system librairies” It’s akward

A little research says that reinstalling JDK works.

I personally use Intelij these days. I gave up on eclipse because of multiple issues with gradle, maven, etc. Intelij just works.

1 Like

Ok it’s good I have re install jdk for the 4 times and I don’t know why but it’s good, so very much without you I don’t suceed. It’s complicated I am 15 years old and I’m french so I use my little vocabulary ^^

So your not getting the compile error. Are you still getting the multiple keys error?

No I don’t have any error

Ok great. So everything is working including your plugin?

1 Like

Yes all work in my plugin