shell execute java

Hello,

why do i get nil exception when i am running:

s.execute ("java -jar /Users/mw/Desktop/files/vnc/viewer.jar -host=10.0.0.38 -password=xxx -showConnectionDialog=No")

if i run the same from terminal i works, but not from within xojo

Have you initialized s ?

dim s as new Shell s.execute ("java -jar /Users/mw/Desktop/files/vnc/viewer.jar -host=10.0.0.38 -password=xxx -showConnectionDialog=No")

Uh, we can’t tell why you’re getting a nil exception, you posted one single line.
I would guess from what little you’ve posted, that s is nil and you didn’t set it up.

sorry, of course i initialized it. :wink:

this was my code originally

dim s as shell dim f as FolderItem=GetFolderItem("").Child("vnc") dim cmd as String cmd="java -jar "+ f.ShellPath +"/viewer.jar -host="+ip+" -password="+passwd+" -showConnectionDialog=No" s.Execute (cmd)

it returns nilobjectexception

soooorrry it must be

dim s as new shell

…embarrassing

It happens to the best of us :wink:

And you may still have issues beyond this as a SHELL is not TERMINAL.app
It does not run your login or startup scripts
This means that the default paths to things are NOT the same between the two

So while “java …” might work in Terminal it might not in a shell as shell has no clue where to find java etc

you are right Norman, but in my case this works now

…but, while the java app runs, my app does not respond anymore, if i close the java viewer everything works again.

tried every s.mode but no change…

Will f.launch work; with batch command or script file containing your “shell” commands?