[HowTo] Upgrading your server to Java 1.7 (jre-7) for Windows

Discussion in 'Bukkit Help' started by Musaddict, Apr 21, 2012.

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

    Musaddict

    Without Java 1.7 installed, certain plugins (mine included) will not work, at all. This is due to the fact that except for Java 1.7, Java 1.6 is the most common version, and sadly the plugins are not backwards compatible.

    Please note that the Java Run-time Environment 7 is currently not available to Mac users. A 1.7 development kit IS available for Mac OS, but Mac OS JDK integration will not be covered by this thread. As for Linux users, I know that since you are running Linux you're more likely to help program for Java than to not know how to instal it, so I'll let you do your own thing.

    1) Before we do anything, check to make sure you don't already have Java 1.7 installed. You can do this by:
    • Start -> "cmd" -> ENTER, and type "java -version" without quotations.
    If the first line is 'Java version "1.7.0"' then skip to step 4, otherwise continue to step 2.


    2) You can download the latest version of Java 1.7 (jre-7) here: http://www.oracle.com/technetwork/java/javase/downloads/java-se-jre-7-download-432155.html. Please make sure to bullet the "Accept License Agreement" option above the download links.
    If you are running a 32 bit version of windows, please select the "Windows x86 Offline" version, otherwise select "Windows x64".​
    3) You may chose to Run the file directly, or save it to a folder of your choice and run it from there. Either way, open the setup and follow the instructions to instal it. Do not change the directory unless you are confident about what you are doing.​
    4) If you already have your server files generated, skip to step 5. Otherwise, please follow this tutorial: http://wiki.bukkit.org/Setting_up_a_server
    5) Navigate to the folder which contains your server files, and locate "RUN.bat" (please note, the '.bat' extension may not be visible). Right click the file and select "Edit". Delete everything in the file, and copy this over:​
    Code:
    @ECHO OFF
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    "%ProgramFiles%\Java\jre7\bin\java.exe" -Xmx1024M -Xms1024M -jar craftbukkit.jar
    PAUSE
    6) Save and close the file.​
    And that's it! Next time you start you server, you will be running Java 1.7.​
     
  2. Offline

    LHammonds

    If you are running a 64-bit version of Windows, it is actually recommended to download and install both the 32-bit and 64-bit versions of Java. However, you can still call the 64-bit version directly when starting your CraftBukkit server.

    Would you mind explaining what "SET BINDIR=%~dp0" does exactly? I have seen this copy/pasted all over the Minecraft forums but I don't think anyone knows the significance. To me, it looks like a broken reference which does not actually work. The "CD /D "%BINDIR%" will not work and everyone says to place the bat file with the craftbukkit.jar file (because those two lines do absolutely nothing).

    LHammonds
     
  3. Offline

    Musaddict

    Good point. As for the SET BINDER line, I just know that the server setup tutorial includes it, so I always have.
     
  4. Offline

    JustCraft

    Will all the plugins running on 1.6 version java break?
    Thanks
     
  5. Offline

    Paswaru

    Opps, didn't notice how old LHammonds post was. Well the info is here if anyone wants it.


    %0 = Is a variable of the batch file name as it was called.
    ~dp is a variable modifier for directory path.
    %~dp0 return the directory path to the batch file.

    Code:
    SET BINDIR=%~dp0
    CD /D "%BINDIR%"
    So SET BINDIR=%~dp0 sets the variable BINDIR to the current full path of the batch file.
    CD /D %BINDIR% preforms a change directory to the path specified in %BINDIR%. The /D tells it to change the current drive in addition to the directory.

    You can find other variable modifier documented in the FOR command.​
    http://technet.microsoft.com/en-us/library/bb490909.aspx

    Trying to run SET BINDIR=%~dp0 from command prompt won't work because %~dp0 is only valid in a batch file. So in turn trying to run CD /D %BINDIR% won't do anything because no path has been assigned to the variable. Try manually setting BINDIR to a path that exists on your system. (i.e. SET BINDIR="C:\Program Files\") then run CD /D %BINDIR%.
     
  6. Offline

    JustCraft

    Anyone? If i go to 1.7, will all the plugins working on 1.6 break?

    BUMP

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

    Musaddict

    Java 1.7 is founded on Java 1.6, so unless plugins use depreciated methods from 1.6 (unlikely), they should work perfectly. So far I have had 0 compatibility issues, and I've had my server running Java 1.7 for months now.
     
Thread Status:
Not open for further replies.

Share This Page