Solved Can't Start Server - Needs Java even if I have it

Discussion in 'Bukkit Help' started by HerobrineLivesHere, Nov 12, 2013.

Thread Status:
Not open for further replies.
  1. I tried to start my server and I can't start it because it says "'java' is not a recognized as an internal or external command, operable program or batch file". I have instaled Java 7 and I even re-installed it and restarted my computer but I can't get it to work. :/ Any help?
     
  2. Offline

    MegaCow2011

    Em... The path probably isnt in the right place... I have no idea though if into futher
     
  3. Offline

    LHammonds

    Use java's uninstaller program...you can find it on their site somewhere which will completely remove all traces of java.

    Reboot your PC, then install a fresh copy of Java 7

    If for some reason that still does not work, provide the full path to the java executable. So if your batch file contains the following line:
    Code:
    java -Xincgc -Xmx1G -jar craftbukkit.jar
    change it to something like:
    Code:
    "%ProgramFiles%\Java\jre7\bin\java.exe" -Xincgc -Xmx1G -jar craftbukkit.jar
     
  4. Didn't work. :( I tried the other one but it instantly Closes and if I use the other one, I just get the same message.
     
  5. Offline

    LHammonds

    Well, I said "something like" that. You need to actually find and see where the java.exe file is located. The path I gave was the default path for Java 7 for both 32-bit and 64-bit systems. I am also assuming you are running some version of Windows.

    If you are not familiar with Windows Explorer (e.g. File Explorer), click on Start, then Run (or type in the search box) and type C:\ (and press ENTER)

    That should open Windows Explorer to the root of C drive. Then double-click on "Program Files", then look for a "Java" folder, etc. Once you find java.exe, you should be able to see the full path in the address line at the top...you can click on it too to show the path as you would type it in the batch file (can even highlight and copy it with CTRL+C)
     
  6. Well, I have Java in Program (x86) and I can only find java.jar. I don't appear to have Java.exe
     
  7. Offline

    p0wd3r

    The full path for the 32 bit version 7 is...
    C:\Program Files (x86)\Java\jre7\bin\java.exe

    For the 64 bit version the path is...
    C:\Program Files\Java\jre7\bin\java.exe

    With those paths in mind, if you open a command prompt, type "java -version" and see if it shows you what version it has. If it gives you an error, go to one of the above paths and type that same thing again. If it still gives you an error, reinstall Java from here --> https://java.com/en/download/manual.jsp
     
  8. Thank you SSSOOO MUCH! :D You saved my server! :D
     
  9. Offline

    LHammonds

    That is if you are assuming it is a 64-bit Windows. If it is 32-bit Windows, there is no (x86) folder. So the "best" path for either one "should" be the C:\Program Files\Java\jre7\bin\java.exe, unless you want to run the 32-bit version of java on a 64-bit OS (which would be odd).

    With the preference toward 64-bit java, here is a batch file I use that works well for 32-bit or 64-bit OS as well as the 32-bit or 64-bit Java version for Java 6 or Java 7

    startcb.bat
    Code:
    @ECHO OFF
    SET RAM2USE=2048
    CD /D C:\CraftBukkit
     
    REM ** Look for a version of Java 7 that matches the OS (32-bit for 32-bit, 64-bit for 64-bit) **
    IF EXIST "%ProgramFiles%\Java\jre7\bin\java.exe" GOTO JAVA7DEFAULT
     
    REM ** Look for 32-bit version of Java 7 on 64-bit OS **
    IF EXIST "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" GOTO JAVA732BIT
     
    REM ** Look for a version of Java 6 that matches the OS (32-bit for 32-bit, 64-bit for 64-bit) **
    IF EXIST "%ProgramFiles%\Java\jre6\bin\java.exe" GOTO JAVA6DEFAULT
     
    REM ** Look for 32-bit version of Java 6 on 64-bit OS **
    IF EXIST "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" GOTO JAVA632BIT
     
    :JAVA7DEFAULT
    REM ** This will execute if run on a 32-bit OS with a 32-bit version of Java 7 **
    REM ** This will execute if run on a 64-bit OS with a 64-bit version of Java 7 **
    "%ProgramFiles%\Java\jre7\bin\java.exe" -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar craftbukkit.jar
    GOTO DONE
     
    :JAVA732BIT
    REM ** This will execute if run on a 64-bit OS with only a 32-bit version of Java 7 **
    "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar craftbukkit.jar
    GOTO DONE
     
    :JAVA6DEFAULT
    REM ** This will execute if run on a 32-bit OS with a 32-bit version of Java 6 **
    REM ** This will execute if run on a 64-bit OS with a 64-bit version of Java 6 **
    "%ProgramFiles%\Java\jre6\bin\java.exe" -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar craftbukkit.jar
    GOTO DONE
     
    :JAVA632BIT
    REM ** This will execute if run on a 64-bit OS with only a 32-bit version of Java 6 **
    "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -Xmx%RAM2USE%M -Xms%RAM2USE%M -jar craftbukkit.jar
    GOTO DONE
     
    :DONE
    REM ** This will pause the screen so you can see any error messages after stopping the CraftBukkit server. **
    PAUSE
     
  10. Offline

    p0wd3r

    LHammonds That script is awesome! I use BukkitGUI though, so I don't have to deal with any of that, still though, great work. :)
     
Thread Status:
Not open for further replies.

Share This Page