Skip to content

Wrap LXStudio Project as Application on OSX

Justin Belcher edited this page Aug 17, 2022 · 15 revisions

Create an executable .jar

Eclipse-specific export

For each of LX, GLX, and LXStudio, in order:

  • Right-click LX project -> Maven -> Update Project
  • Build -> Clean
  • Right-click GLX project -> Maven -> Update Project
  • Build -> Clean
  • Right-click project -> Properties -> Java Build Path -> Source tab -> "GLX/src/main/resources" -> select "Excluded: **" and click Remove.
  • Right-click LXStudio project -> Maven -> Update Project
  • Build -> Clean

Select LXStudio project
File -> Export...
Java\Runnable JAR file
For Library Handling choose "Extract required libraries into generated JAR"
Finish

Test .jar from Terminal and approve microphone access

Open Terminal

java -XstartOnFirstThread -jar myLXStudioProject_2022-08-17a.jar

Approve microphone access when prompted by OSX! If previously denied you might be able to enable it from Settings>Security and Privacy>Microphone>Privacy tab> check Terminal. If Terminal is not in the list you'll need to reset microphone permissions for all applications and start over.

Wrap executable .jar with an application

Create a bash file to run .jar (and any other custom commands)

In the same folder as your .jar add a file lx.sh:

#!/bin/bash  
cd ~  
java -XstartOnFirstThread -jar myLXStudioProject_2022-08-17a.jar  

Confirm it's executable in Terminal:

chmod a+x lx.sh
./lx.sh

In Finder, right-click lx.sh. Change "Open with" to Terminal.

Create an application to run the bash file

Open Script Editor, choose New Document

tell application "Terminal"  
	activate  
	do shell script "$HOME/lx.sh"  
end tell

File->Export:
As Application
None of the options checked

Set Application to run on login

Settings->Users and Groups->(click user)->Login Items

  • Add new -> browse for application

Add the application to the dock

...because that's where you want it.

Tips

Save old .jar files:

Edit the .sh file to target a newly exported jar without recreating the app. If you keep the old jars organized by date you can roll back if needed.

Justin note: there is likely a better way to do this, but was having issues getting the microphone permission when directly executing the application without going through Terminal.