0

Exactly as specified in the title, I'm trying to send data to my ODROID-Show external screen via USB. I'm running a shell script that sends such data. The problem is I can simply run the command through Terminal and it runs successfully and data is sent to my little screen through USB port. When I try to run the same command via Java, Nothing happens.

Process proc = Runtime.getRuntime().exec("/bin/bash -c /home/ahmed/ODROID-SHOW-master/example/linux/images.sh /");

The specified command should have root privileges to run. That, I've switched to root then ran the code and nothing happened. Any thoughts how to solve such problem?

Edit:

IF you can show a code that executes given command prefixed by sudo this will absolutely work.

I was able to run the program as root. but, corrupted data are sent to ODROIDscreen rather than valid images. while it transfers successfully when ran through Terminal, Any thoughts why that happens?

  • In the terminal, do you run it using the exact syntax /bin/bash -c /home/ahmed/ODROID-SHOW-master/example/linux/images.sh / ? – Michal Jan 26 '16 at 14:42
  • no I can only call "sudo ./images.sh" taking into account that I'm currently on scripts dir. I can also call "sudo /home/ahmed/ODROID-SHOW-master/example/linux/images.sh" – Mohamed Badr Feb 07 '16 at 11:04
  • How exactly do you then 'switched to root and ran the code'? I think you shall be able to run the script from terminal using the same cmd line and user used for the Runtime.exec scenario. – Michal Feb 07 '16 at 21:07
  • Could you do sudo /bin/bash -c /home/ahmed/ODROID-SHOW-master/example/linux/images.sh / ? – Michal Feb 07 '16 at 21:08

1 Answers1

1

I would check if the script executed by the bash interpreter requires certain environment variables set before execution.

I'd add a debug line in the executed shell script to dump the environment like "env > my_dump_env.txt" then run the script both from command line as well as from Java and do a diff see what is missing or is different.

RomeoL
  • 11
  • 2