Not directly - the EJB spec. doesn't allow direct IO. There are good reasons for this: an EJB can't make any assumptions about what kind of file system its on, whether the application server has any access right to the file system, where the file resides in a clustered environment, or if there is even a file system at all (e.g. its deployed in something like JServer). Its also difficult to control file access security. And File IO isn't transactional, isn't best fit for enterprise systems.
You can however access the file system through a
JCA adapter. This will sort the problems with file access, and you'll find JCA adapters for file system resources in some Application Servers already.
Another alternative is to use an RDBMS like a file system - and store/retrieve files as BLOBS. A lot of DBAs might be horrified by that suggestion, but it is a quick convenient way round this issue.
[ July 29, 2004: Message edited by: Paul Sturrock ]