1

I have built an application that includes a JAR file I developed and I've had issues trying to run it correctly from the AppleScript application with:

set foobar to POSIX path of (path to me) & "Contents/Resources/Scripts/foobar" as text

I have thought about checking usr/local/bin if the JAR file exists and then copying the JAR from the application to usr/local/bin but I'm unsure if this is the correct place to add JAR files so I can call them from AppleScript or through terminal. Is there a better approach to do this? I do have another block that checks to see if a program has been installed by Homebrew by checking /usr/local/Cellar/ then running the rest of the AppleScript application with do shell script but I'm unsure where all installed additional programs should be placed so I can run them with AppleScript and Terminal. What is the correct way to do this?

  • Could you expand on what issues you've experienced when placing the JAR files in Contents/Resources/Scripts/? – jaume Nov 14 '18 at 18:10
  • @jaume it throws an error. – ʀ2ᴅ2 Nov 14 '18 at 18:11
0

From a SIP perspective, /usr/local/bin is perfectly fine to place JAR files.

SIP excludes the directories:

  • /usr/local
  • /Libraries
  • /Applications

Anything in these directories can be read/written/executed. Which one of those makes more sense for you to place your JAR files is entirely up to you. (IMO), since it is a run-time and presumably it's part of an application, putting it in a sub-directory within the /Applications directory is not a bad place to start.

  • 1
    but will the bin also allow for me to able to execute the JAR with foobar command in the terminal if placed there? – ʀ2ᴅ2 Nov 14 '18 at 17:44
  • SIP doesn't prevent execution. – Allan Nov 14 '18 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .