Search code examples
javaeclipsejavafxjar

Eclipse importing external Jar not working


I'm working on a JavaFX project, where multiple people develop their own game and export it as a jar for me to implement in some kind of game launcher. We all use Eclipse as our editor and I import the jars via buildpath > Classpath > Add external jar. Now this in itself worked, but now one of the developers sent an updated version of their game jar. When i try to implement it the same way as before, Eclipse goes completely crazy.

1. Auto suggest breaks

Image showing Popup Errormessage when auto suggest should be shown This pops up when auto suggest should be shown, for instance when writing Main.

Image showing another Popup Errormessage when auto suggest should be shown This pops up asap after I hit OK on the first popup error

2. Text Highlighting breaks

Image showing creation of an instance without color coding
The Code now typed is not color coded anymore, but there's also no error message that the class is not found for instance

3. Error Message for using functions of the instanciated class

Image showing an error when trying to execute a function of the class
When trying to execute a function that is in the class PasswordPuzzle (the main class of the faulty jar) for instance, I get the error that the function does not exist. However I can successfully compile and when running, the function is executed. I know that because getScene() throws an IOException, and that's what I get in my console when running. Image showing another Error Message
And it gets even weirder: When I add another line of code below, and try to access any function in any other class (even my project itself, not some jar), the upper line stops saying that the function does not exist and now only the new line shows the error.

4. Can't open Build path

When trying to open the Configure Build Path window, I get the error popup that The currently displayed page contains invalid values. I can only open it again after I delete the jar file in the mac finder.

My Question

I have no idea what's happening or where to even begin looking for solutions. I tried cleaning the project, restarting the computer, importing the jar again. I also had the developer send me a new jar. Nothing worked. None of the other jars have that problem, so it has to have something to do with his code. Which is even weirder since it worked with his earlier version as well, and he only tweaked small stuff that can't be the problem. So: any clues what may be happening here?


Solution

  • The reason for this was that the jar included the Main.java. When exporting to jar we had to uncheck the Main.java and now everything works as expected.