Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

The source of this problem is that Jar Launcher (/System/Library/CoreServices/Jar\ Launcher.app) runs the jar just perfectly (as far as I know, the Jar Launcher app is the one that runs jars which you double click in finder), but I need to set a memory buffer limits.

So I've tried to run the jar like:

java -Xms1024m -Xmx2048m -jar <path_to_jar>

And when I run a jar like this, I get an exception:

Exception in thread "Thread-11" java.lang.NoSuchMethodError: net.minecraft.Util.excutePost(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

Do you have any idea what can be wrong with me launching app the way described above? Can you suggest any way to launch the jar like the Jar Launcher does or how to specify memory buffer limits for Jar Launcher?

EDIT

My console java version is:

java -version
java version "1.6.0_33"
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)

But I have no idea how to find out what version is Jar Launcher using

share|improve this question
    
Programming question should be posted on Stackoverflow. I flag your question in this sense. –  Ermiar Aug 18 '12 at 8:50
1  
The reported error indicates something else is wrong - a bad minecraft library? –  Thorbjørn Ravn Andersen Aug 18 '12 at 9:00
    
@ThorbjørnRavnAndersen the thing is that when it's being run by double clicking everything works ok. And that's what I want to find out: how the jar is being run by double clicking and how it differs from the way I've launched it from terminal –  Uko Aug 18 '12 at 9:26
1  
/Applications/Utilities/Java Preferences.app, a screenshot could be helpful if several versions are displayed –  patrix Aug 18 '12 at 15:17
1  
Since Jar Launcher is something Apple delivers and people wanting to run java programs will need to know how to configure that tool, it's clearly on topic here. If the focus becomes how to modify the java code to work with Mac's limitations, then it starts to stray, but configuring or documenting a runtime tool is on topic here. That being said, if the OP wants to have it migrated to Stack Overflow or another site since programmers might be a better resource to know this part of Mac better - we would be open to that request by the author if the question doesn't get answers in a week's time... –  bmike Aug 18 '12 at 21:07
show 4 more comments

1 Answer

The problem is that you need to specify the class paths with the cp option to java and the library paths with the D option. The Minecraft launcher under /Applications handles this if you have a default install. If you want to run the default configuration from the commandline, just run something like the following with the memory values of your choosing:

java -Xmx2048M -Xms512M -jar \
/Applications/Minecraft.app/Contents/Resources/Java/MinecraftLauncher.jar

Here's an example of how I run Minecraft from the command-line for ad-hoc mode. I put the following in a script, name it and run it by name:

MCHOME="$HOME/Library/Application Support/minecraft/bin"
CP="$MCHOME/minecraft.jar:$MCHOME/lwjgl.jar:$MCHOME/lwjgl_util.jar:$MCHOME/jinput.jar"

java -Xmx2048M -Xms512M -cp "$CP" \
    -Djava.library.path="$MCHOME/natives" \
    net.minecraft.client.Minecraft
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.