Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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: 7801

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]

#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: 9061

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?

The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#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