|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: Spawn Shell Process |
|
| Print at Dec 19, 2025, 8:48:29 PM | View all posts in this thread on one page |
| Posted by treehousenorris2 at Sep 14, 2020, 9:15:40 PM |
|
Spawn Shell Process Hello! I'd like to execute a shell command from my plugin's java. I am getting "cannot run program" errors, such as the following. Is there anything Sweet Home specific to folder or spawn permissions that would affect this? `hdiutil mount ~/Downloads/SweetHome3D-6.4.2-macosx.dmg` `cd ‘/Volumes/SweetHome3D-6.4.2/Sweet Home 3D.app/Contents/MacOS’` `./SweetHome3D` java.io.IOException: Cannot run program "sh" (in directory "/bin"): error=316, spawn failed at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) java.io.IOException: Cannot run program "adb" (in directory "/usr/local/bin"): error=316, spawn failed at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) I'm working on a plugin to act as a one-click exporter to transfer the home's .obj file (etc) from a mac onto an android mobile device. Thanks! |
| Posted by Puybaret at Sep 15, 2020, 5:08:04 PM |
|
Re: Spawn Shell Process What Java method did you try to run your command? Under which Sweet Home 3D version? I wouldn’t be astonished that the sandboxed version available on the Mac App Store doesn’t allow such a feature. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by treehousenorris2 at Sep 15, 2020, 6:42:24 PM |
|
Re: Spawn Shell Process Sweet Home 6.4.2 from SourceForge. To see the Sweet Home stdout I am using the dmg>app>executable because I wasn't able to get the Sweet Home jar to run from the terminal (not on mojave but worked on a catalina machine). Mojave only works by double clicking the Sweet Home jar, which defaults to open with Jar Launcher, but without stdout. @Override public void execute() { routine(); } public void routine() { Process process; try { process = Runtime.getRuntime().exec( new String[]{"bash", "-c", "pwd"}, null, new File("/bin")); printResults(process); } catch (IOException e) { e.printStackTrace(); } } public void printResults(Process process) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = ""; while ((line = reader.readLine()) != null) { System.out.println(line); } } |
| Posted by treehousenorris2 at Feb 5, 2021, 8:43:56 PM |
|
Re: Spawn Shell Process Got a shell to work from a plugin used with the SourceForge Sweet Home on Windows. |
| Posted by treehousenorris2 at Mar 9, 2021, 3:26:26 PM |
|
Re: Spawn Shell Process Aha, the jre bundled with Sweet Home for Mac needed an executable permission on jspawnhelper. chmod u+x /Applications/Sweet\ Home\ 3D.app/Contents/Plugins/Java.runtime/Contents/Home/jre/lib/jspawnhelperor <target name="macosxBundle"... |
| Posted by Puybaret at Mar 9, 2021, 4:10:34 PM |
|
Re: Spawn Shell Process Thanks for the information about jspawnhelper, I updated build.xml accordingly. ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
|
|
Current timezone is GMT Dec 19, 2025, 8:48:29 PM |