Plugins Fail to Compile

Discussion in 'Plugin Development' started by AmateurChairSitter, Jul 31, 2014.

Thread Status:
Not open for further replies.
  1. Hi, I don't know if this technically belongs here but I couldn't think of anywhere else to post it. My apologies if it's out of place.

    Out of nowhere my projects are completely refusing to compile and I'm given this error:
    Now, I'm guessing the problem is that it's looking for tools.jar in the jre7 when it should be looking in my jdk. I've done everything I can think of to try to fix this:
    • Googling the error gave me five results. The most useful information in them said to set the JAVA_HOME variable to the location of my jdk. Guess what the value of my JAVA_HOME variable is? "C:\Program Files\Java\jdk1.7.0_65"
    • Another piece of information I found said to edit the PATH to include %JAVA_HOME%\bin. My PATH already includes that.
    • I uninstalled all my jres and jdks and reinstalled them. Again, this did nothing.
    • I deleted everything Eclipse and Maven from my computer and reinstalled from scratch. This did nothing.
    • I tried making a new workspace but unsurprisingly this didn't work.
    • Along the way I made a regular "Hello world" program and that worked just fine which led me to believe the problem might be with Maven.
    • Deleted .m2 folder in my user account folder then reinstalled m2eclipse. Didn't help.
    Eventually I tried making a new project from scratch and to my surprise, it compiled without issue. I'm now guessing that the problem lies somewhere in the configuration files of my existing projects but I've looked through each file and I can't find anything that looks relevant. I suppose I could recreate each of my projects but that would be a huge headache that I'd rather not do.
    If needed, I can post a zip of one of my projects but I'll have to scrub it of personal information as I include my name in my package name.
    Thank you for your time. Any help is greatly appreciated.

    Edit: Extra information: I'm running Win 8.1 64 bit and I'm using Eclipse 4.4 64 bit and Java 64 bit

    Edit 2: Here's a pom.xml from a project that compiles.
    Here's a pom.xml from a project that does not compile.

    Edit 3: I decided to go ahead and upload one of the projects that won't compile. I've gone through and removed my name from wherever I found it but other than that it's exactly how it is when it won't compile. Link. For those curious, this project was just a proof of concept for myself that I did and it's not meant to have any real use on a serious server.

    Edit 4: Another user was able to download my project and compile it so the problem must be somewhere on my computer, not in the project like I had thought.

    Edit 5: I discovered the .m2 folder in my user account folder. I uninstalled m2eclipse then deleted that folder and reinstalled m2eclipse. Still not working.

    Edit 6: Well now I have no idea what to think. Some of my projects are compiling and some aren't. I'm just going to recreate the ones that don't and be done with it. I'll bump this thread every now and then to get it more exposure in case someone who knows how to fix it might see it.

    Edit 7: bojangle posted this suggestion:
     
  2. Offline

    Goblom

    AmateurChairSitter Reinstall JDK, your are missing your "tools.jar" that should come packaged with JDK
     
  3. Goblom I've already reinstalled the JDK. I have tools.jar in \jdk1.7.9_65\lib\tools.jar
     
  4. Offline

    Goblom

    AmateurChairSitter Hmm, it says its a problem with jre. did you reinstall that as well?

    Edit: im an idiot

    Im not sure how to fix the problem, but good luck.
     
  5. Offline

    _LB

    Could we see the pom.xml files for a project that does compile and a project that does not?
     
  6. Goblom Thanks for trying. I've been banging my head against my desk for many hours now trying to get this to make sense. I'll be sure to update this post if I figure it out.

    This one compiles.

    This one does not compile.

    I have taken my name out of the groupId but other than that and the renaming of the files these are the files exactly as they exist in the projects. The artifactId of the one that does compile is gibberish because I was just creating a new project to see if it would work and I was frustrated so I just hit the keyboard a couple times.

    Edit: Clarity.

    Edit2: I've added a zip of one of the projects that won't compile in the op.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  7. Offline

    _LB

    Weird, I can compile your project just fine :(
     
  8. _LB Well thanks for trying. At least this tells me it might not be a problem in the project.
     
  9. Offline

    Spemble

    AmateurChairSitter
    Do we at least know how to have the problem not arise again in the re-creations?
     
  10. Honestly, no. I have no idea what caused it or why it didn't happen again when I recreated the project. It affected about 30% of my projects and I couldn't find any information about this beyond "Make sure JAVA_HOME points to your JDK".
     
  11. Offline

    Geekhellmc

    maybe you should change the package to me.(you).(plugin) and be sure it's the same on your .jar file! It should be like:
    me.(you).(plugin).tools
     
  12. I'm not sure what you mean. The package name in my project? The tools is referring to a jar which is located in %jdk%\lib\, not in the project.
     
  13. Offline

    mythbusterma

    AmateurChairSitter

    I had found some instructions on how to do this, but they were out of date, so I guess I'm making it.

    Go to Window -> Preferences -> Java -> Installed JREs, you should find a window similar to this one:
    [​IMG]

    Select the item labeled "(default)" and click "Edit...", you should be presented with a screen that has a field similar to this one:

    [​IMG]

    In this field you have to put the location to the actual JDK, not the default value. I had this same problem, for me it was originally set to "C:\Program Files\Java\jre7\" when it should be set to "C:\Program Files\Java\jdk1.7.0_65" (replace "jdk1.7.0_65 with your installed version of the JDK).
     
    Krizeh likes this.
  14. I just checked that field on my current workspace. It has "C:\Program Files\Java\jre7\" in it and I'm not having any problems compiling. Then I created a new workspace and imported one of my old projects that wouldn't compile. The field there also says "C:\Program Files\Java\jre7". Also, to my surprise, the old project compiled. This error continues to get more and more befuddling.
     
  15. Offline

    bojangle

    okay... i fixed this and was having problems like a mofo...
    do this:
    windows > preferences > installed jres > click edit on the selected jre/jdk > add external jar > add in tools.jar
    FIXED! :D
     
  16. Offline

    Geekhellmc

    @bojsangle you should post a thread on the recourse page because I saw many others having the same problem
     
  17. bojangle I can't test this anymore but it looks promising so I'll add it to the op.
     
Thread Status:
Not open for further replies.

Share This Page