Howdy,
You shouldn't be doing File I/O operations from JSPs or servlets in
general.

You can't get the server directory or webapp directory in a
servlet-specification compliant way.  In fact, they might not even
exist, e.g. if you're running from a packed WAR on a database server.

The only directory you are guaranteed read/write access to is the
context temporary directory.  It's available via (File)
getServletContext().getAttribute("javax.servlet.context.tempdir");

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: zeallousbigpond.net.au [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, October 15, 2003 8:45 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Can JSP run sys command lines?
>
>
>Thanks...
>
>I ran a mkdir anson command in JSP...it works.....but for some
>reason.....it makes the directory in my root directory??...I mean..i
>thought JSP treats the main webapp dir ,say, /webapps/anson
>as its main dir
>
>How can I make it so it points to that directory?
>
>Anson
>
>----- Original Message -----
>From: Tim Funk <[EMAIL PROTECTED]>
>Date: Wednesday, October 15, 2003 10:32 pm
>Subject: Re: Can JSP run sys command lines?
>
>>
>> The restrictions are the same as launching any process from java.
>> Such as
>> - Relative vs absolute command line
>> - If relative - is the current working dir correct
>> - Is the user_id of the running process correct
>> - Environment variables carried to the child process
>> - If there is a secutiry manager - will it allow exec
>> - ...
>>
>> -Tim
>>
>> zeallousbigpond.net.au wrote:
>>
>> > Can JSP call system exec commands in linux?.....
>> >
>> > Runtime.getRuntime().exec("pdflatex")
>> >
>> > does this work in JSP? ......fyi, pdflatex is installed in
>> another server..
>> >
>> > so..when you run exec in tomcat...does it run and view those
>> commands/programs that exist ONLY in the tomcat directory?
>> >
>>
>>
>> --------------------------------------------------------------------
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to