Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macguin

macrumors newbie
Original poster
Jul 7, 2009
11
0
I am really tired of looking at the terminal window, trying to decipher through time stamps and iChat formatting what people are asking me. I was thinking I could make GUI application that would be built around the craftbukkit.jar file. The only problem is I do not know how to execute .jars in a program, how to send commands to them, or receive and parse information from them (like logout events or chat). It there any way to do this?
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
Have you ever written any kind of program before? If so, in what language?

Do you know what standard-input and standard-output streams are (stdin, stdout)?
 

macguin

macrumors newbie
Original poster
Jul 7, 2009
11
0
Have you ever written any kind of program before? If so, in what language?

Do you know what standard-input and standard-output streams are (stdin, stdout)?

I have written several iPhone apps, so obviously objective c. Also Java and C++.
Also applescript, but I personally don't consider it a real programming language.

I have no experience with standard-input and standard-output (no idea what it means)
 
Last edited:

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
I have no experience with standard-input and standard-output (no idea what it means)

Then you will need to do some research before attempting to write your GUI front-end.

Have you written any Java code that uses Runtime.exec() to run another program? If so, you may have used the Process's inputStream, outputStream, and errorStream to get data from the process, send data to the process, or read the error message from the process. All three streams are the "standard" streams of the child process: stdin, stdout, stderr (their C symbol names when using stdio.h).

In a Java program, the System.in, System.out, and System.err streams are that process's stdin, stdout, and stderr streams.

In a shell command, < redirects stdin to a file, > redirects stdout, and 2> redirects stderr.

In a shell pipeline, such as cat fee fie foo | sort, the stdout of the cat process is connected to the stdin of the sort process by a pipe (see: man 2 pipe). Both processes run concurrently. sort will wait for input, and cat will wait for its stdout pipe buffer to drain, so the processes never outrun one another nor are they starved for data.
 

chown33

Moderator
Staff member
Aug 9, 2009
10,751
8,423
A sea of green
How do I set the launch path for the NSTask to the minecraft_server.jar?

You don't. The launch path should be the 'java' command, which is responsible for running the Java classes in the jar.

You'll need to know the full path of the java command, so in a Terminal window, enter this command:
Code:
which java
The path it tells you is a standardized location, but I'm telling you how to do this so you know it for other commands.

You'll also need to read the man page for the java command, so you know how to tell it that the minecraft_server.jar is a jar-file and not a class, a defined system property, or some other parameter.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.