Sign in to follow this  

C#/Java: Can't launch JAR from C# + Exception log

Recommended Posts

Drakken255    173
Hello all,

I am trying to manually start the minecraft.jar with the needed username and session ID, and I receive a java exception.


ProcessStartInfo mcStartInfo = new ProcessStartInfo("java", "-Xms1024m -Xmx1024m -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 + " " + sessionID);

The exception is close to the following (I can't copy/paste, but rather retype):

Exception in thread "main" java.lang.NoClassefFoundError: org/lwjgl/LWJGLException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
at$ (Unknown Source)
at$ (Unknown Source)
at (Native Method)
at (Unknown Source)
at java.lang.ClassLoader.loadClass (Unknown Source)
at java.misc.Launcher$AppClassLoader.loadClass (Unknown Source)
at java.lang.ClassLoader.loadClass (Unknown Source)
... 6 more

Share this post

Link to post
Share on other sites
Ashaman73    13715
Try to remove the spaces in the classpath
[source lang="java"]"\\.minecraft\\bin\\minecraft.jar; " => "\\.minecraft\\bin\\minecraft.jar;"[/source]

and add an space after the last class path entry
[source lang="java"]"\\.minecraft\\bin\\lwjgl_util.jar\" => "\\.minecraft\\bin\\lwjgl_util.jar \"[/source]

Share this post

Link to post
Share on other sites
Bacterius    13165
[quote name='Drakken255' timestamp='1346854758' post='4976825']
Now the real problem is that I can't seem to start Minecraft at 1024m or above. Only at 512 or below. Why is that, especially when I have 32g of ram?
Holy crap, 32GB! Umm, do you have 64-bit Java? The 32-bit one is limited to 2048MB of heap and MC might be doing some behind-the-scenes allocation. Does the JVM say anything when you try with 1024MB or does it like... not start?

Share this post

Link to post
Share on other sites
Drakken255    173
Java allows me to start both a legit Minecraft client and a server at 8GB each and at the same time, so I'm easily assuming I have 64-bit. When my program tries to start the process, a message box pops up with something like "Could not start Java Virtual Machine. Fatal exception occurred. Java will now exit."

EDIT: It will now work at 1024m, but not at 2048m.

EDIT 2: Also, Minecraft starts with the java icon. I tried the following to change it, but it doesn't work:

//Class level:
public static extern int SendMessage(IntPtr hwnd, int message, int wParam, IntPtr lParam);
private const int WM_SETICON = 0x80;
private const int ICON_SMALL = 0;
private const int ICON_BIG = 1;

//Method level:
SendMessage(minecraft.MainWindowHandle, WM_SETICON, ICON_BIG, Icon.FromHandle(this.Handle).Handle);

//Also tried:
//SendMessage(minecraft.MainWindowHandle, WM_SETICON, ICON_SMALL, Icon.FromHandle(this.Handle).Handle);
[/code] Edited by Drakken255

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this