Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Drakken255   Members   -  Reputation: 173

Like
0Likes
Like

Posted 05 September 2012 - 05:52 AM

Hello all,

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

Code:

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 java.net.URLClassoader$1.run (Unknown Source)
at java.net.URLClassoader$1.run (Unknown Source)
at java.security.AccessController.doPriviledged (Native Method)
at java.net.URLClassLoader.findClass (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

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 11960

Like
0Likes
Like

Posted 05 September 2012 - 07:15 AM

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]

Ashaman

 

Gnoblins: Website - Facebook - Twitter - Youtube - Steam Greenlit - IndieDB - Gamedev Log


#3 Drakken255   Members   -  Reputation: 173

Like
0Likes
Like

Posted 05 September 2012 - 08:12 AM

Holy goodness, it works!!1! Thanx!!!

#4 Drakken255   Members   -  Reputation: 173

Like
0Likes
Like

Posted 05 September 2012 - 08:19 AM

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?

#5 Bacterius   Crossbones+   -  Reputation: 11740

Like
0Likes
Like

Posted 05 September 2012 - 08:51 AM

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?

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”


#6 Drakken255   Members   -  Reputation: 173

Like
0Likes
Like

Posted 05 September 2012 - 03:13 PM

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:
[DllImport("user32.dll")]
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:
minecraft.Start();
minecraft.WaitForInputIdle();
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);

Edited by Drakken255, 05 September 2012 - 09:08 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS