Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown


Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Image I = getImage(getCodeBase(), "1.gif");
Image I = getImage(getDocumentBase(), "1.gif");
both of these return a java.lang.NullPointerException WHY? The file is in the directory. What am I doint wrong??
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing wrong with either line, so there must be a problem either somewhere else in the code or in the location of the files.
Here is a little test:

and the html

Compile and put the resulting class file (ImageLoader.class), the html file, and your image file in the same directory. This should work. Then compare your code to it to see what is different.
If you still have problems, let us know.

[This message has been edited by Carl Trusiak (edited November 30, 2000).]
There’s no place like But I'll always remember this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic