Today I'v been trying to upgrade my custom "Minecraft.exe" launcher to force Java to allocate more RAM!
Basicly I'v been trying to achive this:
Minecraft.bat
@echo off
set minMemoryAllocated=1024
set maxMemoryAllocated=1024
echo #==========================================#
echo # M I N E C R A F T A L L O C A T O R
echo # created by: Victor Karlsson
echo #==========================================#
echo #=== PARAMETERS ===========================#
echo Starting Minecraft with:
echo Minimum RAM allocated: %minMemoryAllocated%
echo Maximum RAM allocated: %maxMemoryAllocated%
javaw -Xmx%minMemoryAllocated%m -Xms%maxMemoryAllocated%m -jar "F:\SomeDirectoryHere\Minecraft.exe"
Into C# .exe file!
But I'm running into problems when I'm trying to get this line to work:
javaw -Xmx%minMemoryAllocated%m -Xms%maxMemoryAllocated%m -jar "F:\SomeDirectoryHere\Minecraft.exe"
Oh and I'm also using:
processInformation.EnvironmentVariables["appdata"] = currentDirectory;
To allow Minecraft to be played from my USB and such without the use of APPDATA folder.
Anyways this here is my C# code so far!:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace Minecrafter
{
class Program
{
public static readonly string currentDirectory = Directory.GetCurrentDirectory();
public static readonly string minAllocatedRAM = "1024";
public static readonly string maxAllocatedRAM = "1024";
public static readonly string pathCommand = "javaw -Xmx1024m -Xms1024m -jar \"" + currentDirectory + @"\" + "Minecraft.exe\"";
/*Just for testing!*/
public static readonly string c = "\"" + currentDirectory + @"\Minecraft.exe" + "\"";
public static readonly string b = @"javaw -Xmx1024 -Xms1024 -jar " + c;
static void Main(string[] args)
{
Console.ReadKey(false);
Console.WriteLine("#==========================================#");
Console.WriteLine("# M I N E C R A F T A L L O C A T O R");
Console.WriteLine("# Created by: Victor Karlsson");
Console.WriteLine("#==========================================#");
if (!File.Exists(currentDirectory + @"\Minecraft.exe"))
{
Console.WriteLine("ERROR: Please make sure Minecraft.exe is placed in the same directory as Minecrafter.exe");
Console.ReadKey(false);
}
else
{
try
{
ProcessStartInfo processInformation = new ProcessStartInfo(b);
processInformation.UseShellExecute = false;
processInformation.EnvironmentVariables["appdata"] = currentDirectory;
Process.Start(processInformation);
Console.WriteLine("\n#=========PARAMETERS===================#");
Console.WriteLine("Minimum RAM Allocated: {0}", minAllocatedRAM);
Console.WriteLine("Maximum RAM Allocated: {0}", maxAllocatedRAM);
Console.ReadKey(false);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.ReadKey(false);
}
}
Environment.Exit(0);
}
}
}
EDIT:
The problem is that the C# program can't find the .exe to run with the javaw parameters
So after trying I decided to ask you guys!