permaculture playing cards
The moose likes Java in General and the fly likes problem with directory/file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "problem with directory/file " Watch "problem with directory/file " New topic

problem with directory/file

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi, guys:
I urgently need your help. I am working on Win2K.
I try to create a directory, then insert a file into this directory, and write to this directory, such as the following:

File aDirectory = new File("Directory");
File aFileName = new File(aDirectory, "4444"+".dat");

When I test this piece of code, I got the following errors: 1111
.dat (The filename, directory name, or volume label syntax is incorrect)
at Method)
at<init>(Unknown Source)
at<init>(Unknown Source)
at<init>(Unknown Source)
at com.kroger.DirectoryQueue.POGRequestQueueImpl.writeId(
at com.kroger.DirectoryQueue.QueueFileHandler.main(
com.kroger.DirectoryQueue.POGRequestQueueException: Write error
at com.kroger.DirectoryQueue.POGRequestQueueImpl.writeId(
at com.kroger.DirectoryQueue.QueueFileHandler.main(

It seems the code is calling native method. I am wondering what is causing these errors? My setup of directory or file names? Please give your thought.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
I'm not sure I follow you. Do you mean you can't access the file from the line File aFileName = new File(aDirectory, "4444"+".dat");? If so, that's because until you write something to the file object there is no file, only an abstract representation. Your code executed fine on my machine which is also Win2K. Try something like this:

Then you should have a physical file on the system. Also note that uses native methods to interact with the underlying OS file system.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
I agree. Here's the link:
subject: problem with directory/file
It's not a secret anymore!