Page 1 of 1

executeProgram Java 8 and Yosemite

PostPosted: Wed May 13, 2015 2:23 pm
by mmcmanus
Has anyone observed the issue where running the executeProgram with that configuration(Java 8, Yosemite) fails to function properly?

We use it to launch Preview and/or acrobat for viewing some PDF's. We updated things about a week ago and since we have had the issue. Preview or acrobat will try to open/ Dock bounce, menu show in Preview, then immediately quit. If we open Preview and leave it, usually the documents will open. This was never an issue until the upgrade. We also had the issue with calling an applescript with execute program. It fails to run

I suspect it either Java security or Yosemite. And have looked pretty far around, but not found anything to hang my hat on or a setting to make this go away. If this goes to our Windows machines with a Java * upgrade, Iw ill not be happy.

Ideas anyone?

Re: executeProgram Java 8 and Yosemite

PostPosted: Wed May 13, 2015 4:51 pm
by swingman
Hi, we have had something similar happen with Java 7 and Mac OS X 10.7 / 10.8 / 10.9 and Microsoft Word. Unless Word was already open, it would not open the document.
We now use
Code: Select all
function open_a_file(tmpfile) {
   if (utils.stringMiddle(application.getOSName(), 1, 7) == "Windows") {
      application.executeProgram('rundll32', ['url.dll,FileProtocolHandler', tmpfile])
   } else if (utils.stringMiddle(application.getOSName(), 1, 7) == "FreeBSD" || utils.stringMiddle(application.getOSName(), 1, 5) == "Linux") {
      application.executeProgram('mozilla', [tmpfile])
   } else if (utils.stringMiddle(application.getOSName(), 1, 6) == "Mac OS") {
      //to try to fix problem opening word documents, change logic for opening files
      var script = 'tell application "Finder"\n';
      script += '   set command to "open " & quoted form of "' + tmpfile + '"\n';
      script += 'do shell script command\n';
      script += 'end tell';
      application.executeProgram('osascript', ['-e', script]);
      //application.executeProgram('open', [tmpfile]);
   }
   return tmpfile;
}


The Linux FreeBSD branch has never beed used, so no idea whether it works.

Hope this helps,

Re: executeProgram Java 8 and Yosemite

PostPosted: Wed May 13, 2015 5:00 pm
by Harjo
Thanks Christian, for the workaround.

will try that also,

if you look here, there is a solution: viewtopic.php?f=6&t=20084&p=108594&hilit=executeProgram+osx#p108594
but after a while the problem comes back!