In case you only want the date from the server, you can try the java.util.Date Class from the Java library as well.
On 4/20/11, etika ahuja <[email protected]> wrote: > On Mon, Feb 21, 2011 at 4:37 PM, Narendra Sisodiya < > [email protected]> wrote: > >> >> >> On Mon, Feb 21, 2011 at 12:17 PM, etika ahuja <[email protected]>wrote: >> >>> i want to run linux command through a jsp >>> >>> i tried as follows but its not working pls help >>> >>> <%@ page import="java.io.*"%> >>> <% >>> >>> try >>> { >>> Process p=null; >>> Runtime r=Runtime.getRuntime(); >>> String cmd="sh /bin/date>/home/etika/Desktop/aaa/mm.txt"; >>> >> >> >> try >> String cmd="bash /bin/date>/home/etika/Desktop/aaa/mm.txt"; >> String cmd="/bin/date>/home/etika/Desktop/aaa/mm.txt"; >> String cmd="date>/home/etika/Desktop/aaa/mm.txt"; >> >> > > > > > > hello > > information: > tomcat6 is running my jsp page ,so all the linux commands too are executed > by tomcat6. > but i want to run these linux commands from a different user etika on my > system through this jsp page which is executed by tomcat. > > (on running the linux commannd the ownership of the file gets changes to > tomcat6 but i don't want the ownership of the file to be changed on > executing it ,so can i run this linux command from a different user etika so > that my ownership doesnot changes ) > > -- > LUG@IITD - http://lug-iitd.org/Footer > -- Ankur Kumar Pre-Final Year Masters in Computer Applications Birla Institute of Technology MESRA Ranchi - 835215 Mobile: +91-9162971729 -- LUG@IITD - http://lug-iitd.org/Footer
