FileNotFoundException when using the Help.addBook method
328264Jan 20 2003 — edited Feb 21 2003Hi,
I tried to use the following code:
HelpSet helpSet = new HelpSet(myUrl);
Help help = new Help();
help.addBook(helpSet);
However, when trying to launch my application, a "FileNotFoundException: c:\Documents%20and%20Settings\...\myToc.xml" is thrown !
This problem occurs when using the JDK 1.4 (it does not seem to depend on the version of Oracle Help for Java: I tried to use successively 4.1.16, 4.1.17 and 4.2 versions !).
When developping my own application, I encountered a similar problem and found that it was related to a change in the java API. More precisely, prior to JDK 1.4 beta, getClass().getResource("myFile").getFile() would return "/c:/Documents and Settings/myFile" which could be used to read "myFile". But in JDK 1.4 beta, it returns a location that has spaces translated into %20 characters ("/c:/Documents%20and%20Settings/myFile") which cannot be used as a valid file name in java.io.File or java.io.FileInputStream classes.
Could you help me ?
Carine.