Java: Using other files in Eclipse -
so in order part of assignment have use outside files. , believe i've done correctly, i'm still getting error.
here how project set up:
as can see i'm trying load audio 2001.mid , image nightsky.jpeg. both of located in resources file inside of project three. don't see what's wrong, i'm new type of thing. appreciated.
also not note stddraw in lib folder. there no problem either.
this error when trying run it.
mar 24, 2014 4:00:24 pm java.util.prefs.windowspreferences <init> warning: not open/create prefs root node software\javasoft\prefs @ root 0x80000002. windows regcreatekeyex(...) returned error code 5. exception in thread "main" java.lang.illegalargumentexception: image resources/nightsky.jpeg not found @ stddraw.getimage(stddraw.java:656) @ stddraw.picture(stddraw.java:671) @ nbody.main(nbody.java:17)
typically, resources
set src
, same package structure. add both resources
, src
source folders in eclipse.
now both source folders, resource files copied bin
folder, right next class files try read them. should able reference them like...
stdaudio.play("2001.mid"); // note, no resources folder prefix
Comments
Post a Comment