• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to use a Scanner in a bean?

 
Paul Adcock
Ranch Hand
Posts: 48
Firefox Browser Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using a Scanner to scan a text file, but despite putting it right in the source folder, ti says it can't find the file. Am I doing something wrong or are beans not allowed to use Scanners?

It seems to only work with an absolute path but I can't give it one if I intend to make it a jar file.

I've placed copies of the file in all sorts of spots in the Nebeams project but it simply can't find it, despite being able to see it from the files window under the projects part in the src package part.



Right now I have it having the user ask for the directory, but that is a pain for the user. However, it will work if I do that.
 
Greg Charles
Sheriff
Posts: 2993
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to be a bit clearer. You're trying to read a file that's in a jar file? Is that the file it says it can't find? I assume the bean you mean is a JSF managed bean, and thus the connection to JSF, but I don't think you're issue is with JSF, so I'll move this over to our General Java forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic