[Tinyos-help] run cygwin command from Java : work around
Hristo Bojkov
hbojkov at idxs.eu
Mon Sep 10 02:32:46 PDT 2007
Hello Amrit,
I am not sure that I understand what you wish to do. If I am right you just
try to execute script under bash, but when a Java program need to start it.
My idea is that you don't need a complicated Java tool/app to open bash and
to write in console stream. Instead you just need a simple bat file to open
a bash env, and from this point to execute a simple script file. If you need
dynamic script, then just save the script from memory to a file with name
like the one, that is executed by the bat file, and just then execute the
bat file under MS command prompt.
As I see you just need from your Java to be able just to start a bat file,
from which body to execute a bash command interpreter and under bash to
execute a script, like "a.sh" that they gave you. To start script under bash
is very easy, at least in C++ is, I am C++ coder, so cannot tell you HOW-TO
in Java.
The bat file you need can look like:
_________________________________________
@echo off
C:
echo Invoking bash environment now
bash --login -i /opt/tinyos-2.x/tools/tinyos/idxs/idxs-makeit
_________________________________________
The function of the bat file above is to execute the "idxs-makeit" script
file. Of course you can make your own folder with all files in it and change
the names - I.e. Do not using mine names....So the body of mine script
idxs-makeit" is very simple. It just executes make under bash, and looks
like:
_________________________________________
#!/bin/sh
cd /opt/idxs/apps/Test/
make tmote install,1 bsl,15
_________________________________________
This script can be saved every time I need to compile for a mote, and I
change the Node ID and the comport according to a input in program that
executes the bat file.
Hope that helps....
Hristo Bojkov
Platform: WinXp/Cygwin
TinyOS: 2.0.2
Device: Tmote
-------Original Message-------
Message: 6
Date: Fri, 7 Sep 2007 11:35:41 +0530
From: "amrit Kumar" <amritkr at gmail.com>
Subject: [Tinyos-help] run cygwin command from Java : work around
Found with a new problem :)
To: schip at santafe.edu
Cc: tinyos-help at millennium.berkeley.edu
Message-ID:
<94d2f2890709062305h346ea0f1v68b85df6a46271a0 at mail.gmail.com>
Content-Type: text/plain; charset="ISO-8859-1"
Hi All,
Schip,
Thanks for the effort.....It was gud to see that u atleast made an attempt
To extend what both of us seem to know............
However from my side, I seem to have found a work around that now requires
The code from a file (a.sh) to be copy pasted on the bash shell. I was just
Trying around a lot of things and came across that this works fine ..
1. From 'run' start a bash shell ( bash.exe) , make sure the bash path is
Set in path variable.
2. Copy paste the whole of a.sh command on the bash shell.......
I know it is a low level kinda work around ....... But it works :)
It works just fine........ All this above has to be done from Java .. Hmm ..
Your inputs would be very helpful.
Thanks
Amrit
More information about the Tinyos-help
mailing list