HidenCloud
English
Ask or search…
K
Links

Java Local Binary

In this tutorial we will explain how to install the java bin locally in a Windows environment.
Install the local Java binary allows you to have multiple versions of Java in a Windows environment without having to modify the system environment variables.
Step 1: Download the Binary First, you need to download the binary for the Java version you want to install. To do this, go to the official Oracle website and find the corresponding version. Download the JDK .zip file for the Windows version.
How to download the Java binary?
First, open your web browser and search for: java 8 jdk download (replace "8" with the desired version if you want to download a different version of Java).
Download the Java SE Runtime Environment from the search results.
Next, search for the binary for Windows x86 (32-bit) and Windows x64 (64-bit). To download the complete binary, choose the .tar.gz file instead of the .exe file.
*Java now requires you to have an account to download the binary. Simply create an account or log in if you already have one.
Step 2: Extract the File
Navigate to the location where the .tar.gz file was downloaded, then extract the content to a location of your choice. You might choose to create a folder named "Java" in your home directory and extract the content there.
How to extract the Java binary?
Our recommendation is to use WinRAR, which you can download for free from the following LINK.
Once installed, locate the .tar.gz file, in this case jre1.8.0_202.tar.gz, right-click on it, select "WinRAR," and then choose "Extract Here."
*If you're setting up a Minecraft server, it's recommended to place the extracted files in the same folder as the server (for dynamic path usage). In this case, we've created a folder named "Test" on the desktop, but this folder can be placed anywhere with any desired name.
Step 3: Access the Binary
The Java binary will be in the resulting folder, which will consist of various files and directories. If you've followed these steps, it should be named something like jre1.8.0_202 or jdk1.8.0_181, with the version varying. Within this folder, you'll find another one called "bin." This is the folder containing the binaries that allow you to run Java locally. The two executables included in the binary are java.exe and javaw.exe (java.exe will execute the file with the Java console, while javaw.exe will execute the file without the visual Java console, hiding it).
Step 4: Using Local Java
Instead of changing your system's environment variables, all you need to do to use this local Java installation is refer directly to it when entering commands. For example, if you want to compile a Java file, the normal command would be "java TestFile.java." However, if you want to use the local Java, you need to specify the full path to your Java binary.
Instead of just "java," the command should look something like this:
C:\Users[your username][path to the extracted binary folder]\jre1.8.0_202\bin\java.exe TestFile.java
In our case, it might look like this:
C:\Users\YourUsername\Desktop\Test\jre1.8.0_202\bin\java.exe TestFile.java
This will compile the file using the Java binary you extracted, not the one installed in the system's environment variables.
Step 5: Create a Batch File (.bat extension)
To avoid typing out the full path each time, you can create a batch file in the same directory where your .java files are located. This batch file can contain the complete command, so you only need to run the batch file to compile your Java files.
An example of a batch file for a Minecraft server USING the binary directly (locally) might be:
@echo off
:start
"C:\Users\[your user]\[path to the folder where you extracted the binary]\jre1.8.0_202\bin\java.exe" -Xms1G -Xmx2G -jar spigot.jar nogui
timeout 10
goto start
  • -Xms1G -Xmx2G -jar spigot.jar nogui timeout 10 goto start
  • -Xms1G is the argument that sets the minimum amount of RAM allocated to your Minecraft server (in this case, 1 gigabyte).
  • -Xmx2G is the argument that sets the maximum amount of RAM your Minecraft server can use (in this case, 2 gigabytes).
goto start is used to restart the server in case of crashes, bugs, or restarts.
If the binary folder (jre1.8.0_202) is in the same folder as the Minecraft server, you can use the following code:
@echo off
:start
"jre1.8.0_202\bin\java.exe" -Xms2G -Xmx27G -jar spigot.jar nogui
timeout 10
goto start
Since the binary is in the same folder as the server, Windows will use the dynamic path to find the file. This way, you don't have to specify the entire path, just the path starting from the folder where the batch file is located.
An example of a batch file for a Minecraft server NOT USING the binary directly (locally) and using Windows environment variables could be:
@echo off
:start
java -Xms1G -Xmx2G -jar spigot.jar nogui
timeout 10
goto start