[opencms-dev] Running dos command 'net use' in opencms
Manasa PV
Manasa_PV at mindtree.com
Mon Mar 6 13:43:02 CET 2006
Hi,
I am trying to run the command 'net use', to get the details of the mapped
drives on my system.
If I run the command through command prompt or a stand alone java program, I
get the correct result. That is :
New connections will be remembered.
Status Local Remote Network
-----------------------------------------------------------------------------
OK G: \\dt1637-nirmapsd\docapp Microsoft Windows Network
Disconnected \\dt2069-manasa\myMusic Microsoft Windows Network
The command completed successfully.
But the same code, when I use in a jsp in opencms it gives the following
result:
New connections will be remembered.
There are no entries in the list.
Is it a security setting that is preventing this command from being executed
in opencms?
This is the code that I use to run the command. The String mappingDetails is
used to store the result of the command.
String mappingDetails = "";
String command = "net use";
Process child =
Runtime.getRuntime().exec(command);
try{
// Read the mapping details and
write it to a String
InputStream in =
child.getInputStream();
int c;
while ((c = in.read()) != -1) {
mappingDetails = mappingDetails
+ (char)c;
}
in.close();
}
catch (IOException e) {
e.printStackTrace();
}
Thanks and Regards,
Manasa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060306/9dc47d1d/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: disclaimer.txt
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060306/9dc47d1d/attachment.txt>
More information about the opencms-dev
mailing list