java - How to make jar files that draw from a source folder -
i've been wanting make executable jar files java lately. when executing code eclipse works perfectly. when use eclipse export same code runnable jar, of jars work except ones draw separate source folders.
the jar made when launched try , open , check console possible errors. try , run jar through console command "java -jar test.jar". , says cannot access jar. ideas? btw im on macbook pro osx. thank you!! picture of files within eclipse
if have file want store in jar , access there, don't have java file more. @ class.getresourceasstream() , class.getresource() - first can give inputstream (used-to-be) file, second returns url , can used things images. note file being accessed can accessed relative package/folder location of class or relative classpath root (by putting "/" @ front of resource name ("/resource/funny.jpg")).
when execute jar command line, aware have thing called "default directory"; folder in commands execute default. if jar not in default directory, have specify valid folder path jar execute it.
Comments
Post a Comment