This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes The system cannot find the path specified Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "The system cannot find the path specified" Watch "The system cannot find the path specified" New topic

The system cannot find the path specified

carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Hi i have written a jsp which browse for a file and read its contents .. when i browse the file the IE is passing complete file path to the servlet
C:\example\book1.xls where as when i try to run the same program on Firefox it says file cannot be found.. seeing this is thought i will restrict my application to be used on IE, but now when i run my app(server running on my machine) from other machine it tries to search the file on my machine and give errors


C:\Documents and Settings\rsrinivasan\Desktop\plots.xls (The system cannot find the path specified)
at Method)
at<init>(Unknown Source)
at<init>(Unknown Source)
at excelread.FAFilePopulate.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.http11.Http11Processor.process(
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(
at org.apache.tomcat.util.threads.ThreadPool$
at Source)


where onchange send the file name to the servlet

please suggest me something how do i get the file path where instance of the application is running on some other system other then mine

[ November 06, 2008: Message edited by: Paul Sturrock ]
[ November 09, 2008: Message edited by: ruquia tabassum ]
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

where onchange send the file name to the servlet

What uploads the file to the server? Does the file C:\Documents and Settings\rsrinivasan\Desktop\plots.xls exist on the server?
[ November 06, 2008: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

as tomcat is running on my system c:\Documents and Setting\rsrinivasan\plots.xls doesnot exists on my system, plots.xls file exists on the system name rsrinivasan.... as instance of my application is running on rsrinivasan system from there when a file is uploaded it gives me the error "system cannot find the path specified"
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15094

The way you're trying to do it, doesn't work.

Tomcat does not automatically get the file and does not automatically save it on the server if you add a file upload input element on your HTML form. You need something to handle the file upload. Use a library, such as Apache Commons FileUpload for example, to get the file from the client computer and save it on the server.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
carina caoor
Ranch Hand

Joined: Jun 23, 2007
Posts: 300

Instead of saving the file from client computer on the server machine cant there be any other possible solution? because i cannot store the file on the server machine it increases the overhead on server, the application is accessed by suppose 100 employees and every one uploads a file every 10 minutes and each file is more than 500KB per day around 50000 files get stored on the serve machine ... which makes the server less efficient,slow.

if i run a batch such that the temporary files stored are to be deleted every morning still there will be some point of time in a busy day where the server gets loaded with large data and becomes slow.
Also as the server maintains all the live database i cannot store and delete files from it very frequently...

Please suggest me something how do i solve this issue...
I agree. Here's the link:
subject: The system cannot find the path specified
jQuery in Action, 3rd edition