Terminal – Is usr/local/bin the Correct Directory for JAR Files?

applescripthomebrewjavaterminal

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?

Best Answer

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.