The result ( stdout ) is empty because the command was performed successfully. The message that you see printed on screen in Terminal is coming from stderr.
To get the output you see in Terminal passed back you have to redirect sterr to stdout.
do shell script "/usr/bin/java -version 2>&1"
My problem is not getting stderr out, my problem is that the java command fails when used from within FileMaker Pro, whether I call it via plug-in or via AppleScript.
It might be worth checking this out:
It indicates that when you are trying to invoke java via "do shell script" in AppleScript, that the command is not run with the same environmental context that you would have by running the command directly in Terminal.
Running the command directly in Terminal, you may be getting the benefit of an environmental variable being set (and helping you out).
To pursue this as a possibility, I'd suggest seeing if you have a .bashrc or a .bash_profile file (or both) in your user's home directory, and, if so, read the contents of these files and see if any environmental variables are being set (such as JAVA_HOME) which you might want to try incorporating into your command when run via Applescript.
That's just one idea of something to look into. Hope it helps, and good luck,
I have solved the issue.
This thread explains what was happening on my machine:
When calling Java 7 directly everything seemed fine.
Then I followed the advice to install JDK 7 and now everything works as expected.
Not sure if it was some system variable missing or an incompatibility of Java 6 but making sure that I am using Java 7 is a sufficient solution for me.
So I see, I'll have to learn to read!
I'm sure that the solution will be Paths or Permissions.