This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check the file/found or not

 
Rodricks george
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,

I have a file in c:\window\test.dll.... i want to create a program so that i should check the file present in that directory or not......

Please give some idea....

-Rodricks
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Rodricks george
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much sir.....
 
Rodricks george
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,
The File Checking program i have written in action class.... if i deploy it in weblogic in Linux server and if i get access to that action class it is checking That machine OS information but i am opening the application in Windows PC..... it is not checking in my PC.... What to do to get my PC information... pls solve that

-Rodricks
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is not checking in my PC

What does that mean? Are you running the code Rahul posted and it is not giving the correct result?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Rodricks george , could not get much from you post. ;-)
 
Rodricks george
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir,

This is my code


String osname=System.getProperty("os.name");
System.out.println(osname);
String userHome=System.getProperty("user.home");
System.out.println("User Home Direcory:->"+userHome);




boolean exists = (new File("C:/WINDOWS/jtwain.dll")).exists();
if (exists) {
// File or directory exists
System.out.println("Found jtwain.dll");
return mapping.findForward("success");
} else {
// File or directory does not exist
System.out.println("Not Found jtwain.dll");
request.getSession().setAttribute("winDir","C:/WINDOWS");
return mapping.findForward("fail");
}



i wrote this one in action class..... i deployed the struts program in weblogic in linux OS...... While executing the application from server i got only linux machine system properties.... I want client side system properties...... whoever open my website i should get their system properties...... so that if they dont have the corresponding dll file...i will ask them to install it in c:\windows directory.... Pleas help me how to check the file found or not in client side.

-Rodricks
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Action class is part of struts framework and will be executed in the server side. So its obvious that you will get the properties of the server machine , now the client machine.

Though I have not worked on applets , but I think applet would be the choice if you want to do something like this as the applet bytecodes will get executed on the client side , not on the server.
 
Rodricks george
Ranch Hand
Posts: 97
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Rahul Sir,

As you said i created a J applet Program and got the client details and got the user.home information and checked the windows folder and i redirected to a jsp from applet and the program is successfully running... Thank you sir for really perfect information at rite time...

-Rodricks
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic