0

I am writing an app that uses the .scpt file to execute a jar in the same directory. I know how to use applescript to get the current directory, and I know that I did it correctly because when I print how my command, which looks like this:

do shell script "/usr/bin/java -jar /Users/name/Desktop/test.app/Contents/Resources/Scripts/myJarFile.jar"

Now the problem is, if I copy and paste this into a terminal, it runs properly, but in applescript it gives me this error:

error "Exception in thread \"main\" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:838)
at java.util.Scanner.next(Scanner.java:1347)
at Runner.main(Runner.java:22)" number 1

Also, I have tried executing a shell script that runs the above command, but to no avail (when it is called from applescript of course).

JFakult
  • 327
  • 1
  • 2
  • 16
  • Do you know what the code is supposed to be doing? Is it reading something from standard input or opening some sort of file and parsing it? – davecom Oct 08 '13 at 13:14
  • It seems not to be applescript related, I think this is Java related. Does the application run all by itself? – ppeterka Oct 08 '13 at 13:17
  • Hmmm, you may be right. I realize now that the error comes because there is no console for my program. How can I open say, Terminal, and run the jar script from there? – JFakult Oct 08 '13 at 13:24
  • This question should help you: http://stackoverflow.com/questions/1870270/sending-commands-and-strings-to-terminal-app-with-applescript – davecom Oct 08 '13 at 13:29
  • Aha! I solved it! I made a .command script, and rather than saying "sh scriptName.command" I said "open -a Terminal scriptName.command" – JFakult Oct 08 '13 at 13:33

0 Answers0