Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problem with applet accessing text files in its jar file

Posted on 2003-11-24
5
243 Views
Last Modified: 2010-03-31
I have an applet that uses 4 text files. I want to put it all together in a jar file and upload it to my site. But I'm having problems accessing the text files I've put inside the jar file. The error is a NullPointerException on the line:
InputStream dataStream = getClass().getResource(filename).openStream();
in the FlatFile.java class.

Can anyone suggest a solution for how to achieve what I want?
0
Comment
Question by:asswasp
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9811459
What is held in 'filename'?
0
 

Author Comment

by:asswasp
ID: 9811477
Just a string like "alan.txt"
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 50 total points
ID: 9811493
Try

"/alan.txt"

0
 

Author Comment

by:asswasp
ID: 9811672
Thank you.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9811695
:-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 104
difference of if loops 23 62
spring jars download 1 35
How do I remove an object from a 3 40
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question