• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading a .txt file from SystemClassloader

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

I am somehow not able to read a .txt file from a SystemClassloader.

I think I am missing out on something but unable to findout.

I would really appreciate if someone could help me out as I have a deadline tday.

I have a file which is saved on my C:\Server\temp33 folder.

This path I have included in my System class path when I start my Weblogic server in its startweblogic.cmd file

here is the snippet:

CLASSPATH=%CLASSPATH%.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;%WL_HOME%\config\mydomain\applications\DefaultWebApp\WEB-INF\lib;%WL_HOME%\config\mydomain\applications\DefaultWebApp\WEB-INF\classes;%WL_HOME%\config\mydomain\applications\DefaultWebApp\WEB-INF\conf;C:\Server\temp33\;.;

Now I want to read a file which is stored in the temp33 folder in my applet which is a part of a WAR which is a part of an EAR.

Snippet of The Applet where I am trying to read the file:

datainputstream = new DataInputStream(ClassLoader.getSystemClassLoader().getResourceAsStream(filename));
System.out.println("GOT ^^^^^^^^^^^^^^^^^^^^^ ** ");
System.out.println("GOT INPUTSTREAM -**> "+ datainputstream.available());

But I am getting a null pointerexception at GOT INPUTSTREAM -**

The filename is a variable which I am passing to the applet through my JSP.

It could be anything like xyz.txt.

I think I am doing all the steps properly but may be I am missing out on something .

Regards,
Navin Keswani.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic