0

I made a Java application which runs another Java code using the java -cp "xxx.jar;xxx.jar" net.minecraft.client.main.Maincommand. The ; (or :depending on the OS) between the two JAR of the classpath is provided by the System.getProperty("path.separator") function.

On Windows it works fine, but not on Mac OS. Java says it cannot find or load main class net.minecraft.client.main.Main. I checked, the JARS of the classpath are correctly spelled and existing on the hard drive at the proper path.

Here is the whole command (/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java is the path to the Java executable) :

http://pastebin.com/8V3pg07q

Could you help me ? I am NOT requiring help on how to play Minecraft, it is not the official launcher (it is one I've made, which obviously doesn't work on Mac OS), so don't tell me to ask help at Minecraft Forums :P

Thanks !

2
  • you mean File.pathSeparator? Commented Mar 30, 2014 at 17:39
  • @rupps: Well, I suspect the OP means System.getProperty("path.separator") Commented Mar 30, 2014 at 17:41

1 Answer 1

1

It's not clear what you meant by "I tested forcing usage of ; even on Mac OS" but basically you should use the right path separator for the platform when you run the new Java process.

So on Windows you'd want:

java -cp xxx.jar;yyy.jar

On Unix you'd want

java -cp xxx.jar:yyy.jar

In the code where you're building the command line arguments, just make sure you use the path.separator property (or more simply File.pathSeparator) appropriately so that you can build the right command line without having to detect the actual operating system.

EDIT: I don't know why this isn't currently working for you, unless it's because the command line itself is too long.

You could consider putting all the relevant jar files into a single directory, and then using:

java -cp 'somedirectory/*' net.minecraft.client.main.Main

Alterantively, use the extensions mechanism... but that's a last resort, and may cause other issues.

Sign up to request clarification or add additional context in comments.

15 Comments

I tried using ; on Mac because I was not sure that :was the right one, seemed weird to me, but now I keep the path.separator ^^
@natinusala: Well it's hard to tell from your question, because it's unclearly worded. There's no indication in your question that you ever tried the colon as a separator in the Mac version. I suggest you edit your question with more details - including how you're starting the process, and where exactly the jar files are.
I edited the question, I hope to be more clear now (I'm not english so there might be some errors)
@natinusala: Well which of those jar files contains net.minecraft.client.main.Main?
It's 1.7.5.jar, the first one of the list.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.