java - NullPointer Exception while read audio files -


i made program read audio files. @ first did absolute path because it's easyer develop.
then cahnge relative path because want compress *jar. code method(at first short later code:

1.: @ first make filearray save files 2.: make array save audioclip 3.: loop read clips 

now code:

    private audioclip[] liesaudiodateien (file inputfile) {         file[] datefilearray;         audioclip[] tracks;         datefilearray = inputfile.listfiles();         tracks = new audioclip[datefilearray.length];         (int = 0; < tracks.length; i++) {             if (datefilearray[i].isfile()) {                 try {                     tracks[i] = applet.newaudioclip(datefilearray[i].tourl());                 } catch (ioexception ex) {                     system.err.println("error!: -- " + ex.tostring());                 }             }          }         return tracks;        } 

inputfile.listfiles() returns null, seems path isn't ok. path ok, because let print on command line. d:\eclipse\myprojekt\dist\myproject.jar\audio. in netbeans, work. if make jar file, doesn't work.

i have try:

  1. d:\eclipse\myprojekt\dist\myproject.jar\audio\
  2. / in place of \

are sure correct file path?

d:\eclipse\myprojekt\dist\myproject.jar\audio 

the audio directory in folder called myproject.jar?

if audio files within .jar file cannot use file class list them. have instead read entries .jar file, in question.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -