How can I automatically change the priority of Javaw.exe when loading Minecraft?

I launch Minecraft.exe which invokes Javaw.exe. I wish for Javaw.exe to be running in High priority because Minecraft lags if not.

I tried invoking Minecraft.exe with a high priority by doing this:

Start "Minecraft" /high "C:\Users\Barrie\Documents\Program Files\Minecraft\Minecraft.exe"

This would work if it wasn't for Minecraft loading Javaw.exe. I would love a simple solution - perhaps a command I can put into the batch script - which will change the priority of Javaw.exe after it loads.

Edit: I'd like to thank everyone for their response to my issue. I fixed this by executing Minecraft.exe with a batch script then calling an AHK script to change the priority of Javaw.exe.

3

6 Answers

What I would do:

Use process explorer to get the full parameters passed to javaw to launch the game and then use them with start.

For safe guard, you can put the command in a batch file and use some command line utility to raise the priority of explorer.exe to the same level, so you can use the Windows key to escape from the game.

I don't play Minecraft, but if the above didn't work, it is probably due to some preparation work done by Minecraft.exe being omitted. In this case you may need to use some stub program to wrap either javaw.exe or the Java class it is calling.

@echo off
start "Minecraft" /high "C:\Program Files\Java\jre6\bin\javaw.exe" -Xmx1024M -Xms1024M -jar MinecraftLauncher.jar
@echo off
@ECHO OFF
SET BINDIR=%~dp0
CD /D "%BINDIR%"
"%ProgramFiles%\Java\jre6\bin\java.exe" -Xmx1024m -Xms1024m -jar MinecraftLauncher.jar
PAUSE

And if that didnt work

@echo off
start "Minecraft" /high "C:\Program Files\Java\jre6\bin\javaw.exe" -Xmx1024M -Xms1024M -jar MinecraftLauncher.jar
@echo off
@ECHO OFF
SET BINDIR=%~dp0
CD /D "%BINDIR%"
"%ProgramFiles%\Java\jre6\bin\java.exe" -Xincgc -Xmx1G -jar MinecraftLauncher.jar
PAUSE

This one works the best for me. After I adapted your code to merge with this, its best for me because if my Minecraft decides to crash, I can quit before it corrupts, so if you're gonna use one, these are best.

Try this:

START "minecraft" /high /wait "C:\Program Files\Java\jre7\bin\javaw.exe" -Xms1024m -Xmx2048m -cp "%APPDATA%\.minecraft\bin\minecraft.jar;%APPDATA%\.minecraft\bin\jinput.jar;%APPDATA%\.minecraft\bin\lwjgl.jar;%APPDATA%\.minecraft\bin\lwjgl_util.jar" -Djava.library.path="%APPDATA%\.minecraft\bin\natives" net.minecraft.client.Minecraft <username> <password>

You can do that in Task Manager, right clicking on the javaw.exe process you have a Set Priority option.

Process Explorer from Sysinternals also has that.

1

I changed the priority of it using a little batch script.

@echo off
start "Minecraft" /high "C:\Program Files\Java\jre7\bin\javaw.exe" -Xmx1024M -Xms1024M -jar "%appdata%\.minecraft\minecraft.exe"

Try Process Tamer. May not be what you exactly want but it will help. Use its configuration to set javaw.exe to high priority.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like