Solved

Java Web Start and FileInputStream

Posted on 2004-08-04
3
617 Views
Last Modified: 2008-02-01
Hello,

I want to open file from within java web start jar file.

I tryied to use FileInputStream, like this:

FileInputStream storefilestream = new FileInputStream(keystore);

but java throws exception that file not found, but it's in main jar file from where I'm loading web start application.

How can I open file from jar file?
0
Comment
Question by:beside
[X]
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
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 100 total points
ID: 11716027
this.getClass().getResourceAsStream( keystore ) ;

should do it...  (keystore should be a path relative to this class, or the root of the jar file this class is in)
0
 

Author Comment

by:beside
ID: 11724002
This way I can't get file stream from jar file.. i used instead

this.getClassLoader().getResourceAsStream( keystore );

this works O.K. for me.

But anyway thank you for showing the right way.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11724049
:-)

Glad you got it sorted :-)

Good luck with it!

Tim
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

733 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