[Tool]Server launcher which checks java

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

  1. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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

    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:
    :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
    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:
    :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

    This post has been edited 7 times. It was last edited by jacklin213 Jul 25, 2012.
    vam-knosen and Magi1053 like this.
  2. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  3. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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??
  4. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @vam-knosen on a 64 bit computer java is usally downloaded into programfiles(x86) because its a 32bit program
  5. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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! :)

    This post has been edited 3 times. It was last edited by vam-knosen Jul 20, 2012.
  6. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  7. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    THX 4 all help :) im on vacation 4 a Week so i cant test It now
  8. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    tell me how it is when u get back
  9. Offline

    ImminentFate

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Whoa dude, how long did it take you to make this?!
  10. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    like 30 min y? did i do something wrong??
  11. Offline

    ImminentFate

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Nothing wrong, it just looks so boss, lol.
    It makes my head go crazy using batch :p no structure to it
  12. Offline

    XENGS

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    But there is also a 64 bit version...

    This post has been edited 1 time. It was last edited by XENGS Jul 25, 2012.
  13. Online

    TnT Trinitrotoluene Maximus Administrator Bukkit Help

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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.
  14. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @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

    This post has been edited 1 time. It was last edited by jacklin213 Jul 25, 2012.
  15. Online

    TnT Trinitrotoluene Maximus Administrator Bukkit Help

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @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)
    

    This post has been edited 2 times. It was last edited by TnT Jul 25, 2012.
  16. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    @TnT so is there anything i should change in my code?

    This post has been edited 1 time. It was last edited by jacklin213 Jul 27, 2012.
  17. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    im confused lol
  18. Offline

    Coelho

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Create tools to further undermine progression. Beautiful.
  19. Online

    TnT Trinitrotoluene Maximus Administrator Bukkit Help

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  20. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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
  21. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    does anyone here know some sort of dirctory code (not cd)
  22. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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

    This post has been edited 1 time. It was last edited by vam-knosen Jul 28, 2012.
  23. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    rename ur craftbukkit-1.2.5-R4.0 to craftbukkit.jar
  24. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    it says the same but maybe if i test with the new bukkit 1.2.5-R5.0?
    I test it...

    This post has been edited 1 time. It was last edited by vam-knosen Jul 29, 2012.
  25. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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)
  26. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    wait what java do u have?
  27. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    i have java 1.7.0_05 (says the cmd when i type: java -version)

    This post has been edited 1 time. It was last edited by vam-knosen Jul 30, 2012.
  28. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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

    This post has been edited 1 time. It was last edited by jacklin213 Jul 31, 2012.
  29. Offline

    vam-knosen

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    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

    This post has been edited 2 times. It was last edited by vam-knosen Jul 31, 2012.
  30. Offline

    jacklin213

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    lol my bad fixed the codes i just post. where is your java installed?

Share This Page