JAR not working
I have made an application in Eclipse and I want to make JAR file now.
I have done Export to JAR file from Eclipse but it's not good.
I have .txt files and .bmp files that my application uses and I have put them all in JAR file but when I double click on JAR file it wouldn't start. Only way it can start is to put those .bmp and .txt files separately in same directory where JAR file is, and then it's working.
Why is this happening and how to make it work only with JAR file?
[505 byte] By [
BobMila] at [2007-11-26 16:17:10]

# 1
It sounds like you are not reading those files correctly. You should be using code like InputStream in = getClass().getResourceAsStream("ATextFile.txt");
Then use the InputStream to read the file. For images, there are constructors in image-related classes that can take a URL as an argument. Without seeing your code, it's hard to give you better answers.
# 2
> It sounds like you are not reading those files
> correctly. You should be using code like
> [code]InputStream in =
> getClass().getResourceAsStream("ATextFile.txt");[/code
> ]Then use the InputStream to read the file. For
> images, there are constructors in image-related
> classes that can take a URL as an argument. Without
> seeing your code, it's hard to give you better
> answers.
Yes, you are right. I have readed files with FileInputStream. I have done as you said and it's working. Thanks!