• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to read file in to jboss server. sending File name as parameter?

 
jahnavi bodhankar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my project i requred file reading in jboss server using file name sending as parameter into function . file is in same system in hard disk.

I am getting following error on server java.io.FileNotFoundException: \models\xyz.txt


Please help me.
Thanks in Advance
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch !!

You post this question in wrong section, FileNotFoundException has nothing to do with on which server your application is running..

Post your code snippet, with relative path of the file you are trying to access, so that we can find out where might be the problem..
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jahnavi, welcome to Java Ranch!

Two things to keep in mind. First, the "current directory" for any code running in JBoss AS is jboss_home/bin, so all relative file lookups will be relative to that directory. Second, any filename starting with a "/" or "\" is assumed to be an absolute file path on the same disk as JBoss AS. For example, is you really gave the filename "\models\xyz.txt", and JBoss AS is running on the D: driver, then the file's path is "d:\models\xyz.txt"

If that does not help, please tell us the full path location for your file, and post the code you are using to access that file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic