[Tool]Server launcher which checks java

Discussion in 'Bukkit Tools' started by jacklin213, Jul 19, 2012.

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

    jacklin213

    i decided to code a server launch which checks what version java u have and what bit windows you have (hope some one hasnt done this yet)

    How to do this for first time craftbukkit users
    Steps (open)

    1) download craftbukit (you have) and put into a new folder
    2)open notepad
    3)paste the code into notepad
    4)save as run.bat in the same folder
    5)double click to run and follow the steps

    What to put into the bat file(new one) version 2.0
    CODE (open)

    Code:
    :start
    @echo off
    color a
    echo.
    echo Welcome to Bukkit launcher made by jacklin213
    echo +-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+
    echo What version of Java are you using?
    echo type help for help
    set /p input="jre: "
    if "%input%"=="6" goto java 6
    if "%input%"=="7" goto java 7
    if "%input%"=="help" goto help
    if "%input%"=="exit" exit
    if "%input%"=="stop" exit
    if "%input%"=="reload" goto start
    if "%input%"=="jre -v" goto jrechecker
    if not "%input%"=="input"
    color 02
    echo Not a valid version!
    pause
    goto start
    cls
     
    ---------------------help----------------------------
     
    :help
    @echo off
    cls
    color a
    echo.
    echo Welcome to the help section
    echo
    echo jre -v = checks what version of java your using
    echo 6 = jre version 6
    echo 7 = jre version 7
    echo help = here
    echo exit = quit
    echo stop = quit
    pause
    cls
    goto start
     
    ---------------------java version checker------------
     
    :jrechecker
    @echo off
    cls
    color f
    echo.
    echo Welcome to the java version checker
    echo if it says java version "1.6" type in 6 when u go back to the home screen
    echo if it says java version "1.7" type in 7 when u go back to the home screen
    echo if it says no java installed u need to install java
    echo.
    java -version
    pause
    cls
    goto start
     
    ---------------------java 6-------------------------
     
    :java 6
    @echo off
    color a
    echo.
    echo Is your computer 32 bit or 64 bit?
    set /p bit="bit: "
    if "%bit%"=="32" goto 32jre6
    if "%bit%"=="64" goto 64jre6
    if not "%bit%"=="bit"
    color 02
    echo Not a valid bit
    pause
    cls
    goto java 6
     
    -------------------java 6. 32bit computer------------
     
    :32jre6
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\Java\jre6\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
    -------------------java 6. 64bit computer------------
     
    :64jre6
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
    ---------------------java 7--------------------------
     
    :java 7
    @echo off
    color a
    echo.
    echo Is your computer 32 bit or 64 bit?
    set /p bit="bit: "
    if "%bit%"=="32" goto 32jre7
    if "%bit%"=="64" goto 64jre7bitcheck
    if not "%bit%"=="bit"
    color 02
    echo Not a valid bit
    pause
    cls
    goto java 7
     
    :32jre7
    @echo off
    color a
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles(86)%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
    --------------------java 7 bit selection--------------
     
    :64jre7bitcheck
    @ECHO OFF
    color a
    echo.
    echo What bit java are you running?
    set /p jrebit="jrebit: "
    if "%jrebit%"=="32" goto 32jre7.64comp
    if "%jrebit%"=="64" goto 64jre7.64comp
    if not "%jrebit%"=="jrebit"
    color 02
    echo Not a valid bit
    pause
    cls
    goto 64jre7bitcheck
     
    -------------------java 7 32 bit. 64bit computer-------------
     
    :32jre7.64comp
    @echo off
    color a
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
    ------------------java 7 64bit. 64bit computer----------------
     
    :64jre7.64comp
    @echo off
    color a
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
    

    Change log
    Changes (open)
    added noob friendly guide
    version 2.0 fixed error for 64 bit computer
    version 2.0 added 64bit java selection for 64 bit computer
    version 2.0 added topics above code so u wouldnt get confused
    version 1.0 release


    What to put into the bat file(old one) version 1.0
    CODE (open)

    Code:
    :start
    @echo off
    color a
    echo.
    echo Welcome to Bukkit launcher made by jacklin213
    echo +-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+-=-+
    echo What version of Java are you using?
    echo type help for help
    set /p input="jre: "
    if "%input%"=="6" goto java 6
    if "%input%"=="7" goto java 7
    if "%input%"=="help" goto help
    if "%input%"=="exit" exit
    if "%input%"=="stop" exit
    if "%input%"=="reload" goto start
    if "%input%"=="jre -v" goto jrechecker
    if not "%input%"=="input"
    color 02
    echo Not a valid version!
    pause
    goto start
    cls
     
    :help
    @echo off
    cls
    color a
    echo.
    echo Welcome to the help section
    echo
    echo jre -v = checks what version of java your using
    echo 6 = jre version 6
    echo 7 = jre version 7
    echo help = here
    echo exit = quit
    echo stop = quit
    pause
    cls
    goto start
     
    :jrechecker
    @echo off
    cls
    color f
    echo.
    echo Welcome to the java version checker
    echo if it says java version "1.6" type in 6 when u go back to the home screen
    echo if it says java version "1.7" type in 7 when u go back to the home screen
    echo if it says no java installed u need to install java
    echo.
    java -version
    pause
    cls
    goto start
     
    :java 6
    @echo off
    color a
    echo.
    echo Is your computer 32 bit or 64 bit?
    set /p bit="bit: "
    if "%bit%"=="32" goto 32jre6
    if "%bit%"=="64" goto 64jre6
    if not "%bit%"=="bit"
    color 02
    echo Not a valid bit
    pause
    cls
    goto java 6
     
    :32jre6
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\Java\jre6\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
     
    :64jre6
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
    :java 7
    @echo off
    color a
    echo.
    echo Is your computer 32 bit or 64 bit?
    set /p bit="bit: "
    if "%bit%"=="32" goto 32jre7
    if "%bit%"=="64" goto 64jre7
    if not "%bit%"=="bit"
    color 02
    echo Not a valid bit
    pause
    cls
    goto java 7
     
    :32jre7
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
     
    :64jre7
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit
     
    


    Where to put it?
    In the same file as your craftbukkit.jar

    NOTE THIS WORKS OVER RUN.bat
     
    vam-knosen and Magi1053 like this.
  2. Offline

    vam-knosen

    Thx for the answer (http://forums.bukkit.org/threads/error-when-seting-up-a-server-need-help.87281/#post-1222616) but when i type in that I have java 7 and 64 bit it serch for C:\ProgramFiles (x86)(isn't x86 to 32 bit?)\Java\jre6 (it should be jre7)\bin\java.exe so it dont work, but if u change the code a bit it might work! :) thx 4 the help!

    perhaps it work if u tell me the questions and do a code 4 it, i know i use java 7 but dont know if its 32 or64 bit so u can do 2 codes one with programfiles and one with programfiles(x86) Do u need to know where my craftbukkit is located??

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  3. Offline

    jacklin213

    vam-knosen on a 64 bit computer java is usally downloaded into programfiles(x86) because its a 32bit program
     
  4. Offline

    vam-knosen

    Ok java is mabe in (x86) you do know this stuff better than me (but your code still dont work 4 me :(, maybe cause

    :java 7
    @echo off
    color a
    echo.
    echo Is your computer 32 bit or 64 bit?
    set /p bit="bit: "
    if "%bit%"=="32" goto 32jre7
    if "%bit%"=="64" goto 64jre7
    if not "%bit%"=="bit"
    color 02
    echo Not a valid bit
    pause
    cls
    goto java 7

    :32jre6 ______________32jre6!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit


    :64jre6 ________________64jre6!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    @ECHO OFF
    echo starting server
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    exit


    it should be 32/64jre7???
    But cant you ask me the questions instead of the cmd so you can do a code just 4 my computer, i dunno what you need 2 know 4 that but i can tell you a bit, i have 64bit windows and java7, do you need 2 know where my craftbukkit-1.2.5-R4.0 is located? or where my java is located? just say and i tell you! :)
     
  5. Offline

    jacklin213

    oic i did i little research and just found out there is such thing as a 64 bit java so let me go change the coding a bit
     
  6. Offline

    vam-knosen

    THX 4 all help :) im on vacation 4 a Week so i cant test It now
     
  7. Offline

    jacklin213

    tell me how it is when u get back
     
  8. Offline

    ImminentFate

    Whoa dude, how long did it take you to make this?!
     
  9. Offline

    jacklin213

    like 30 min y? did i do something wrong??
     
  10. Offline

    ImminentFate

    Nothing wrong, it just looks so boss, lol.
    It makes my head go crazy using batch :p no structure to it
     
  11. Offline

    XENGS

    But there is also a 64 bit version...
     
  12. Offline

    TnT Retired Staff

    Instead of these insane launch scripts, why not a tutorial, or script to properly configure the users PATH variable, thus resulting in a launch script that looks like this:
    Code:
    @echo off
    java -Xincgc -Xmx1G -jar craftbukkit.jar
    pause
    
    Not trying to hate on your tool, its great to see. I've just seen these tools show up over the last year and a half, but never a tool to configure the PATH variable so these tools aren't needed.
     
  13. Offline

    jacklin213

    TnT sry im kinda geting lost here
    does this code work?
    Code:
    @echo off
    java -Xincgc -Xmx1G -jar craftbukkit.jar
    pause
     
    
    doesnt it need to know where java is

    sry i have a small brain
     
  14. Offline

    TnT Retired Staff

    jacklin213
    Provided your path variable is correct, it works like a charm.

    If this works (see below), you can run the server with just the "java" command. The rest is only really needed if you want to call a Java version that isn't shown by that command, or if that command fails to find Java. (Note, I, of course, do not have java installed in my c:\users directory). Installing x64 Java does this all for you, but I've seen the x86 Java have problems.
    Code:
    C:\Users\TnT>java -version
    java version "1.6.0_31"
    Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
    Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
    
    Notice how its the same as below?
    Code:
    C:\Users\TnT>"C:\Program Files\Java\jre6\bin\java" -version
    java version "1.6.0_31"
    Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
    Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)
    
     
  15. Offline

    jacklin213

    TnT so is there anything i should change in my code?
     
  16. Offline

    jacklin213

    im confused lol
     
  17. Offline

    Coelho

    Create tools to further undermine progression. Beautiful.
     
  18. Offline

    TnT Retired Staff

  19. Offline

    jacklin213

    oh but I'm interested about the directory thingy I tried to make it so u could type in the folder of where your server was located but it didn't work. :( maybe I just didn't know the code

    does anyone here know some sort of dirctory code (not cd)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  20. Offline

    vam-knosen

    SOMEONE PLZ HELP!
    when i run the run.bat (with this code: @echo off
    java -Xincgc -Xmx1G -jar craftbukkit.jar
    pause) it says Unable to access jarfile craftbukkit.jar!
    my craftbukkit is named craftbukkit-1.2.5-R4.0 I have java 1.7.0_05 and a 64 bit computer
     
  21. Offline

    jacklin213

    rename ur craftbukkit-1.2.5-R4.0 to craftbukkit.jar
     
  22. Offline

    vam-knosen

    it says the same but maybe if i test with the new bukkit 1.2.5-R5.0?
    I test it...

    Now with this code: @Echo OFF
    java -Xmx1024M -Xms1024M -jar "%~dp0craftbukkit.jar"
    PAUSE (and the new recomended build, 1.2.5-R5.0,) it says java.lang.ExceptionInInitializerError again
    (I have tested to reinstall java it dont work either)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  23. Offline

    jacklin213

    wait what java do u have?
     
  24. Offline

    vam-knosen

    i have java 1.7.0_05 (says the cmd when i type: java -version)
     
  25. Offline

    jacklin213

    try this code if your java is installed in ProgramFiles(86)
    Code:
    @echo off
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles(x86)%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    use this code if it is installed in programfiles
    Code:
    @echo off
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
     
  26. Offline

    vam-knosen

    Hi jacklin213 dont go offline, i need your help, in the comment over my the 2 codes is the same, and i think you forgot the x in programfiles(!!!x!!!!86), but i changed that and none of em worked!

    CHECK NEXT SIDE 4 MY NEW COMMENT
     
  27. Offline

    jacklin213

    lol my bad fixed the codes i just post. where is your java installed?
     
  28. Offline

    vam-knosen

    I have 2 javas one 32 bit and one 64 bit so both codes should work but no one does work
     
  29. Offline

    jacklin213

    do u do skype calls? it might b easier that way
     
  30. Offline

    vam-knosen

    yea sure what is your skype name
     
Thread Status:
Not open for further replies.

Share This Page