I am using a Macintosh
When I place a Processing App in the Login Items to launch at startup, it does not launch.
The App icon appears in the Dock and bounces a couple of times as though it is starting to launch, but then it disappears and the app does not launch.
Yes this is what I meant. The command that is executed when you click on an application in the Dock should launch the processing executable and it should behave the same way when clicking on it in the Applications folder.
When I completed my sketch in Processing, and it ran fine as I wanted it to, I executed the File>Export Application command in the Processing menu, which created an application folder with an app icon for the sketch. If I double-click this app icon, the work runs as intended. No problem.
The problem I am running into is, if I put this app icon in Apple’s Users and Groups Sys Prefs under items to be launched at login, the app does not launch. Its icon appears in the dock for a few seconds, bounces up and down a couple of times as though it is about to launch, then quits. This is my problem.
I was referring to an app created with Processing’s Export Application menu.
When I make such an app, it launches fine if I double-click it. But placed in an auto-login account’s section where an app is supposed to launch at startup, it doesn’t launch.
@GeorgeRoland - Just curious, is the source code compiled with Java mode or Android mode? I don’t want to interfere with this thread but I’ve never been able get the Export Application to work for Android on my Mac using OS 11.0.1.
@GeorgeRoland - Not sure why you’re having problems with Apple’s code. Do you know how to use Xcode? I can send you some objc code which uses NSTask to launch an app for you to try. It would be interesting to see if it will launch your Processing created app. If it does then you could try adding this app to the Apple utility.
#!/bin/bash
This is called a shebang. It treats the file as an executable (since you are running on MacOS which is UNIX based) and tells the computer to use the provided interpreter (here /bin/bash which is a program on your computer) .
echo "Lauching Processing sketch..."
echo is a command to print something in the terminal
/path/to/your/sketch
is launching your sketch executable (make sure it’s executable, otherwise do chmod +x /path/to/your/executable). Replace the path with the real location of your processing exported sketch folder.
> ~/sketch.out
the > character is used to redirect the output (all the text printed to the console from the processing executable, this is what we want) to a file ~/sketch.out.
The ~/ path is referring to your home directory (typically /home/your_name/) where you have your Documents, Pictures, Downloads…
This you will be able to see the output of the processing sketch if there’s an error by inspecting the sketch.out file in your home directory.
I just compiled a Java sketch and exported the application to the Documents/Processing folder. I then used drag and drop to place the app icon in Login Items in SystemPreferences/Users & Groups and restarted the computer. The exported app opened as expected; I was unable to reproduce the problem that you describe.
This is the darndest thing. I tried it today and it worked perfectly. This after doing the same thing over and over and having the app fail to launch and getting a “Quit unexpectedly” error message. I can’t figure this out at all.