eclipse - JAVA, Batch file errors -


i have existing java project compiles , runs through eclipse. have created following .bat file run program sans eclipse:

java -classpath jflashplayer.jar;bin testprogram 

the file saved within project folder, not within bin folder (located in same directory bin). when try run batch, met large number of runtime errors, first being

exception in thread "awt-eventqueue-0" java.lang.noclassdeffounderror: org/apache/commons/io/fileutils 

i'm not sure why error when compiles , runs via eclipse. have commons-io jar files linked project within eclipse libraries, , jar files located in project file (same directory batch file , bin folder).

also, i'm not entirely sure -classpath jflashplayer.jar bit of batch file doing. using jflashlayer.jar library (also linked project within eclipse , in same location other jar files), not sure why appear in batch file. edited existing batch file similar project uses jflashplayer.jar files, , has worked leave part in.

when write code in java, require compile/run outside of ide, have troubles when comes part. perhaps there more robust , foolproof method run program outside of ide other batch file method.

the batch file method fine, have specify libraries you're using on classpath, jflashplayer.jar.

in case, error you're getting because apache commons-io library not specified on classpath. command have like:

java -classpath jflashplayer.jar;commons-io.jar;<other jars ...>;bin testprogram 

alternatively, can create runnable jar eclipse described here. when select library handling strategy, choose option extract required libraries generated jar. make library classes you're using packaged application's jar file, , can execute invoking java -jar my_application.jar.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -