Solved Compile failure - tools.jar not found

Discussion in 'Plugin Development' started by Spemble, Aug 1, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Spemble

    I can't figure out what's wrong :(
    It just won't compile
    Code:java
    1. import org.bukkit.entity.Player;
    2. import org.bukkit.event.EventHandler;
    3. import org.bukkit.event.Listener;
    4. import org.bukkit.event.player.PlayerPortalEvent;
    5. import org.bukkit.plugin.java.JavaPlugin;
    6.  
    7. public class PortalTeleport extends JavaPlugin implements Listener{
    8. @Override
    9. public void onEnable() {
    10. getLogger().info("onEnable has been invoked!");
    11. getServer().getPluginManager().registerEvents(this, this);
    12. }
    13.  
    14. @Override
    15. public void onDisable() {
    16. getLogger().info("onDisable has been invoked!");
    17. }
    18.  
    19. @EventHandler
    20. public void onPortal(PlayerPortalEvent event) {
    21. Player player = event.getPlayer();
    22. player.sendMessage("This command has been executed. YES!!!");
    23. }
    24. }


    Edit:
    In conclusion for anyone else to find this:

    There is currently no way we have found to fix this, but a way around this wall in our paths is to create a new plugin and copy the code over to the new one.

    For the main post:
    Plugins Fail to Compile
     
  2. Is your IDE showing any errors?
     
  3. Offline

    Spemble

  4. Offline

    travja

    It won't compile or it doesn't run on the server?
     
  5. I just copied your code and compiled it without issue. What exactly happens when you try to compile it?
     
  6. Offline

    HeadGam3z

    You don't have a package name above your imports.
     
  7. Offline

    Spemble

    I'm right clicking on the project and clicking Run as... Maven Install and it says Build Failure


    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project PortalTeleport: Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre7\..\lib\tools.jar -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

    Do I not have the right java installed?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  8. That should be showing an error though. He said it's not showing any errors.
     
  9. Offline

    Spemble

    I didn't include the package name as it has my e-mail in it.
     
  10. Oh boy. Allow me to direct you to this thread that I made about this exact problem. I ended up recreating all of my projects that wouldn't compile.
     
  11. Offline

    Spemble

    Oh, sounds like bad news, thank you though, great help!

    I'll mark it solved if that thread works to fix.
     
  12. Go through the steps I did trying to solve this. If you can create new projects that will compile you can at least remake your projects.

    Edit: I never did figure out how to fix it. I just had to start over with each project.
     
  13. Offline

    Spemble

    In conclusion for anyone else to find this:

    There is currently no way we have found to fix this, but a way around this wall in our paths is to create a new plugin and copy the code over to the new one.

    For the main post:
    Plugins Fail to Compile
     
  14. Offline

    mythbusterma

Thread Status:
Not open for further replies.

Share This Page