------ =_NextPart_001_01BEEF9C.8F13EF60
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
try with Process proc =3D Process.getruntime.exec("ls -ld servlets");
and try toread theprocess with a inputstream if the value is null or
something else then it is a not a servlet directory or else it is a
servlet directory just a snipped thats its.
> -----Original Message-----
> From: Joona Palaste [SMTP:[EMAIL PROTECTED]]
> Sent: jeudi 26 ao=FBt 1999 12:36
> To: [EMAIL PROTECTED]
> Subject: Re: How to get a return value from unix to servlet?
>=20
> At 10:56 AM 8/26/99 +0530, you wrote:
> >Hi List,
> > I would like to get the boolean value by executing a unix
> command
> >(ie. ls -ld servlets)
> > on a solaris machine through a servlet.
> > SAY :
> > If "servlets" directory exists then the boolean value is TRUE,
> >otherwise FALSE.
> >
> > Executing a unix command through servlets is OK. But how can I
> get
> >the boolean result by
> > just executing a unix command?
> > Any suggestions/code snippet?
> >
> >Thanks in Advance
> >Rajesh Kumar.
> >
> >Attachment Converted: "d:\eudora\attach\ujayra02.vcf"
>=20
> I asked my system administrator about this. We speculated about it a
> little
> and
> came to the conclusion that there is no way to do this directly from
> Java
> servlets, because it would breach the platform independence. What you
> need
> to do
> instead is to make a native program (C or C++, for example) that
> contains a
> function to call a Unix command and return its result. Then you =
should
> make
> this
> native program into a JNI library (see JNI tutorial at
> http://java.sun.com/docs),
> make a Java class to interface this JNI library, and use this class
> from your
> servlets. I don't know how to make this kind of native program on
> Solaris,
> so I
> can't send you a concrete example, but I've explained the principal
> idea here.
>=20
> Joona Palaste
>=20
> =
______________________________________________________________________
> _____
> To unsubscribe, send email to [EMAIL PROTECTED] and include in =
the
> body
> of the message "signoff SERVLET-INTEREST".
>=20
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
------ =_NextPart_001_01BEEF9C.8F13EF60
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.1960.3">
<TITLE>RE: How to get a return value from unix to servlet?</TITLE>
</HEAD>
<BODY>
<P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">try with Process =
proc =3D Process.getruntime.exec("ls -ld servlets");</FONT>
<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">and try toread =
theprocess with a inputstream if the value is null or something else =
then it is a not a servlet directory or else it is a servlet directory =
just a snipped thats its.</FONT></P>
<UL>
<P><FONT SIZE=3D1 FACE=3D"Arial">-----Original Message-----</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"Arial">From: </FONT></B> <FONT =
SIZE=3D1 FACE=3D"Arial">Joona Palaste [SMTP:[EMAIL PROTECTED]]</FONT>
<BR><B><FONT SIZE=3D1 FACE=3D"Arial">Sent: </FONT></B> <FONT =
SIZE=3D1 FACE=3D"Arial">jeudi 26 ao=FBt 1999 12:36</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Arial">To: </FONT></B> <FONT SIZE=3D1 =
FACE=3D"Arial">[EMAIL PROTECTED]</FONT>
<BR><B><FONT SIZE=3D1 =
FACE=3D"Arial">Subject: </FONT>=
</B> <FONT SIZE=3D1 FACE=3D"Arial">Re: How to get a return value from =
unix to servlet?</FONT>
</P>
<P><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">At 10:56 AM 8/26/99 =
+0530, you wrote:</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">>Hi List,</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">> I would like to get the boolean =
value by executing a unix command</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">>(ie. ls -ld =
servlets)</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">> on =
a solaris machine through a servlet.</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">> =
SAY :</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">> If "servlets" directory =
exists then the boolean value is TRUE,</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">>otherwise =
FALSE.</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">> Executing a unix command through =
servlets is OK. But how can I get</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">>the boolean =
result by</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">> just executing a unix =
command?</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">> Any suggestions/code =
snippet?</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">>Thanks in =
Advance</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">>Rajesh =
Kumar.</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">></FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">>Attachment =
Converted: "d:\eudora\attach\ujayra02.vcf"</FONT>
</P>
<P><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">I asked my system =
administrator about this. We speculated about it a little</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">and</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">came to the =
conclusion that there is no way to do this directly from Java</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">servlets, because =
it would breach the platform independence. What you need</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">to do</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">instead is to make =
a native program (C or C++, for example) that contains a</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">function to call a =
Unix command and return its result. Then you should make</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">this</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">native program into =
a JNI library (see JNI tutorial at</FONT>
<BR><U><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"><A =
HREF=3D"http://java.sun.com/docs" =
TARGET=3D"_blank">http://java.sun.com/docs</A></FONT></U><FONT =
COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">),</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">make a Java class =
to interface this JNI library, and use this class from your</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">servlets. I don't =
know how to make this kind of native program on Solaris,</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">so I</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">can't send you a =
concrete example, but I've explained the principal idea here.</FONT>
</P>
<P><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">Joona Palaste</FONT>
</P>
<P><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">_________________________________________________________=
__________________</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">To unsubscribe, =
send email to [EMAIL PROTECTED] and include in the body</FONT>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">of the message =
"signoff SERVLET-INTEREST".</FONT>
</P>
<P><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">Archives:</FONT><U> =
<FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"><A =
HREF=3D"http://archives.java.sun.com/archives/servlet-interest.html" =
TARGET=3D"_blank">http://archives.java.sun.com/archives/servlet-interest=
.html</A></FONT></U>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 =
FACE=3D"Arial">Resources:</FONT><U> <FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial"><A =
HREF=3D"http://java.sun.com/products/servlet/external-resources.html" =
TARGET=3D"_blank">http://java.sun.com/products/servlet/external-resource=
s.html</A></FONT></U>
<BR><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">LISTSERV =
Help:</FONT><U> <FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"><A =
HREF=3D"http://www.lsoft.com/manuals/user/user.html" =
TARGET=3D"_blank">http://www.lsoft.com/manuals/user/user.html</A></FONT>=
</U>
</P>
</UL>
</BODY>
</HTML>
------ =_NextPart_001_01BEEF9C.8F13EF60--
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html