Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8835285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:13:30+00:00 2026-06-14T09:13:30+00:00

I’m having real issues getting an external script to run from my Java application

  • 0

I’m having real issues getting an external script to run from my Java application on OS X 10.8. It works on Windows, so not sure what I’m doing wrong for OS X.

What works (Windows):

String[] commands = {
    "\"" + _appDataDir + "\\Temp\\Workers\\" + _batchName + "\"", 
    "\"" + _appDataDir + "\\Temp\\frame%d.jpg\"", 
    "\"" + _fileName + "\""};
proc = rt.exec(commands);

So I have the following for OS X:

String[] commands = {
    _appDataDir + "/Temp/Workers/" + _batchName,
_appDataDir + "/Temp/Workers/mac-ffmpeg",   
_appDataDir + "/Temp/frame%d.jpg", 
"\"" + _fileName + "\""};
proc = rt.exec(commands);

This works when there are no spaces in the filename, but fails when there are spaces with a “java.io.IOException: Bad file descriptor” error.

At the moment, I’ve changed all the paths to have no spaces as an easy fix, but I don’t have control over the fileName string as this is selected by the user from a save dialog. I’ve tried with and without double quotes around fileName but neither make any difference.

I also tried ProcessBuilder as below (both with and without the “/bin/bash/, -c” bits):

ProcessBuilder proc2 = new ProcessBuilder(
    "/bin/bash",
"-c",
_appDataDir + "/Temp/Workers/" + _batchName,
_appDataDir + "/Temp/Workers/mac-ffmpeg",
_appDataDir + "/Temp/frame%d.jpg",
"\"" + _fileName + "\""
);
proc = proc2.start();

but this gives the same error. As far as I can tell I’m doing everything that’s being suggested in other similar questions, but nothing is working. Any ideas would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:13:32+00:00Added an answer on June 14, 2026 at 9:13 am

    You don’t need the quotes around "\"" + _fileName + "\"", just a plain _fileName would work here. When you provide an array to Runtime.exec (or to ProcessBuilder) you’ve already split your command up into “words” – if you add the quotes you’re telling it to look for a file whose name is actually double-quote + _fileName + double-quote rather than just _fileName.

    The real problem is likely to lie within the _batchName program, which presumably is a shell script that does the real work by calling other programs. Within that script you will receive the mac-ffmpeg, frame%d.jpg and _fileName arguments as $1, $2 and $3, and you need to make sure that they are properly quoted within the script, e.g. if the script currently says something like

    processFile $3
    

    then you need to change it to say

    processFile "$3"
    

    if it is to cope with file names that contain spaces. Or if it is set up to handle multiple files at once:

    processFiles $*
    

    then you need to replace that with

    processFiles "$@"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a small JavaScript validation script that validates inputs based on Regex. I
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have a text area in my form which accepts all possible characters from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.