Search Results

Search found 1 results on 1 pages for 'user1672817'.

Page 1/1 | 1 

  • FileNotFoundException when using FileInputStream

    - by user1672817
    I am trying to access a file I have contained in the jar. The beginning of my code is as follows: import java.io.*; import java.net.*; public class intro { public static void main(String[] args) throws IOException{ URL jarUrl = intro.class.getResource("myFile.jar"); File myJar = new File(jarUrl.toString()); FileInputStream fis = new FileInputStream(myjar); } I'm getting the following error: Exception in thread "main" java.io.FileNotFoundException: file:\...myFile.jar (The filename, directory name, or volume label syntax is incorrect) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at intro.main(intro.java:10) It seems to have no problem finding the URL or initializing the file, but I can't get the FileInputStream to work. Does anybody know what I'm doing wrong? Help would be appreciated.

    Read the article

1