[CheatSheet] Intel System Studio IoT Edition : Passing arguments to Remote Java application in Edison

Version 1

    Problem statement : Pass arguments to Intel IoT Java Remote Application.

     

    Problem Faced : [Intel System Studio IoT Edition] problem with arguments to be passed to Java application

     

    Explanation : If you put your arguments in 'Run Configuration' this way : -ep testdev1 -key demokey -cp 5688 -ip 192.168.45.7

    ie. in single line, it takes the whole line as a single argument string : "-ep testdev1 -key demokey -cp 5688 -ip 192.168.45.7"

    and creates the shell script :

     

    #!/bin/bash

    rm -f yourAppFifo

     

     

    chmod 777 /tmp/yourApp.jar

    set -e

    mkfifo -m=0666 yourAppFifo

    java -cp .:/usr/lib/java/*:/tmp/yourApp.jar  -Xrunjdwp:transport=dt_socket,server=y,address=8005 com.your.edison.app.hello "-ep testdev1 -key demokey -cp 5688 -ip 192.168.45.7" 2>&1 > yourAppFifo &

    cat < yourAppFifo

    rm -f yourAppFifo

     

    So this essentially fails your application. In Eclipse you will be able to pass arguments this way and you will not face any problem. But Intel System Studio (Based on Eclipse) has a different provision for IoT Java Remote Application.

     

    Solution : The correct way to pass arguments will be putting every argument after a new line. For example :

     

    -ep

    testdev1

    -key

    demokey

    -cp

    5688

    -ip

    192.168.45.7

     

     

    The new shell file created with the arguments will look like this :

     

    #!/bin/bash

    rm -f yourAppFifo

     

     

    chmod 777 /tmp/yourApp.jar

    set -e

    mkfifo -m=0666 yourAppFifo

    java -cp .:/usr/lib/java/*:/tmp/yourApp.jar  -Xrunjdwp:transport=dt_socket,server=y,address=8005 com.your.edison.app.hello "-ep" "testdev1" "-key" "demokey" "-cp" "5688" "-ip" "192.168.45.7" 2>&1 > yourAppFifo &

    cat < yourAppFifo

    rm -f yourAppFifo

     

    So, rather than accepting spaces as separation of arguments, Intel System Studio IoT Java Remote Application 'Run Configuration'  takes newline character as separation of arguments. Hope this CheatSheet helps people.