Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text-Based Java Program



I seem to recall ".command" as a file extension which Finder (Launch Services, I guess) recognizes to open with Terminal.app. So as long as the (executable) shell script file is named appropriately, it should Just Work™. I think.

--
Jamison Hope
email@hidden


On Jul 23, 2007, at 1:41 PM, Adam Ohren wrote:

Hi Matt,

Double-clicking doesn't work here because the Finder tries to launches the JAR without a terminal attached, so System.in is unavailable and System.out goes to the console.log.

I think the easiest way to get what you want is to write a wrapper script, like you mentioned. Like if you're program is called myApp.jar and needs arguments arg1 and arg2, you can create a simple shell script like the following:

#! /bin/sh

java -jar /path/to/jarfile/myApp.jar arg1 arg2;

Make sure the file has its executable permission bit set.

The only caveat is that the Finder on your users system might not be associating shell scripts with the Terminal application, so your users would have to click "Get Info" for the file in the Finder and specify Terminal in the Open With: section.

Then, double-clicking the script will open up a Terminal window and execute your JAR.

Hope that helps,

Adam Ohren
email@hidden

"God does not play dice."
-- Albert Einstein



On Jul 23, 2007, at 12:42 PM, Matthew Strax-Haber wrote:

It's not that it is going to be for experienced users, but rather that I have limited time, this is a quick-and-dirty project, and will only be used by a small group of people for a few hours a month.
GUI is too much work for this project. What would be the best way to write a "wrapper"? Please inform the uninformed :).


Your information and ideas were very helpful.  Thank you.

Thanks,
~Matt

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Text-Based Java Program (From: Matthew Strax-Haber <email@hidden>)
 >Re: Text-Based Java Program (From: Matthew Strax-Haber <email@hidden>)
 >Re: Text-Based Java Program (From: Adam Ohren <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.