Solved

Java Web Start and FileInputStream

Posted on 2004-08-04
3
596 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Unexpected HttpURLConnection connection behavior 2 86
thymeleaf natural templating vs JSP 2 68
servlet doXXX methods 3 38
Spring Framework HTTPSession management 1 24
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to implement Singleton Design Pattern in Java.

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now