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"
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.
Joona Palaste
___________________________________________________________________________
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