cannot find html file


Hello there,

I am trying to run an java example from java.sun. the java class calls some html files. but when i run the application i get html file not found error

i have saved all the files in C:\Java\tree

        book = new DefaultMutableTreeNode(new BookInfo
            ("The Java Tutorial: A Short Course on the Basics",
            "C:\\Java\\tree\\tutorial.htm"));
        category.add(book);

please help

cheers
zolf
zolfAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mick BarryJava DeveloperCommented:
so does that file exist in that directory?
Manikandan ThiagarajanSenior consultantCommented:
save the tutorial.htm file into C:\Java\tree
zolfAuthor Commented:

yes i have saved it in there 100% sure. and i am calling it like this

book = new DefaultMutableTreeNode(new BookInfo
            ("The Java Tutorial: A Short Course on the Basics",
            "C:\\Java\\tree\\tutorial.htm"));
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

radarshCommented:
What does your BookInfo class do?
What are the arguments to the constructor?

________
radarsh
mrigankCommented:
try

C://Java//tree//tutorial.htm

or only

tutorial.htm
el_diosCommented:
Hi,

See the bbokinfo code in the sun site
http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TreeDemo.java

--------------------------------------code-----------------------------------
public String prefix = "file:"
                               + System.getProperty("user.dir")
                               + System.getProperty("file.separator");
        public BookInfo(String book, String filename) {
            bookName = book;
            try {
                bookURL = new URL(prefix + filename);
            } catch (java.net.MalformedURLException exc) {
                System.err.println("Attempted to create a BookInfo "
                                   + "with a bad URL: " + bookURL);
                bookURL = null;
            }
        }
-------------------------------------------------------------------------
it gets the current user dir , say you are executing the code in c:\  it will return u c:, so the htm file has to be in the base dir, i.e c:\tutorial.htm.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
el_diosCommented:
put the file tutorial.htm in current plocation and give(assuming you do not have a package)

 book = new DefaultMutableTreeNode(new BookInfo
            ("The Java Tutorial: A Short Course on the Basics",
            "tutorial.htm"));
        category.add(book);
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.