Modernising some code that currently runs slowly on a 2014 mac mini (Yosemite, Processing 3.5.4) to run on a 2017 iMac (Ventura, Processing 4.4.1). Calls to ‘exec()’ work on the 2014 machine and a 2017 Macbook Pro (Ventura), Processing 4.2) but fail on the other machines (including Mac mini M4, Sequoia, Processing 4.4.1).
The ‘exec()’ call is used to ping google to check internet availability and to execute python code to upload files to google cloud storage. I use the Command.java code of @GoToLoop (thanks!) to get return values, and for the ping call it returns the message: Cannot run program “ping”: error=0, posix_spawn failed
The exec call fails also with a simple Process p = exec(‘ls’) call, returning a less helpful alert ‘Exception while attempting ls’
Ha! And I originally wrote this code in 2016, still tweaking it 9 years later. I recall ‘gotoLoop’ popping up often when I needed help back then. Thanks!
I’ve now moved on to Unity supplemented by Python for data wrangling, so it always does my head in when I have to maintain some Processing code. Still an amazing language though and has got me (and many others) into media art.
Yes. This fixes it for my usage: exec(“ping”) and exec(“python …”)
Tested on iMac (2017, Ventura 13.7.5) and Mac Mini M4 (2024, Sequoia 15.4.1).
However, the code won’t export if ‘embed Java’ is selected regardless of OS version. I generally embed, not sure why :). It does export without embedding java, and does export with 4.4.1. This is with OpenJDK 17 installed. With vanilla ‘hello world’ code the following error is returned:
java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.orElseThrow(Unknown Source)
at processing.mode.java.JavaBuild.exportApplication(JavaBuild.java:756)
at processing.mode.java.JavaBuild.exportApplication(JavaBuild.java:600)
at processing.mode.java.JavaMode.handleExportApplication(JavaMode.java:184)
at processing.mode.java.JavaEditor.lambda$handleExportApplication$19(JavaEditor.java:495)
at processing.app.ui.ExportPrompt.trigger(ExportPrompt.java:345)
at processing.mode.java.JavaEditor.handleExportApplication(JavaEditor.java:504)
at processing.mode.java.JavaEditor.lambda$buildFileMenu$0(JavaEditor.java:233)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
at java.desktop/com.apple.laf.ScreenMenuItem.actionPerformed(Unknown Source)
at java.desktop/java.awt.MenuItem.processActionEvent(Unknown Source)
at java.desktop/java.awt.MenuItem.processEvent(Unknown Source)
at java.desktop/java.awt.MenuComponent.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.MenuComponent.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)