Java command terminal -
alright trying run java file it's not doing want terminal.
i have main directory called packagetester.
packagetester contains src , bin
src has packagea packageb
pacakgea has helloa.java packageb has hellob.java
bin has class files
bin has packagea packageb
pacakgea has helloa.class packageb has hellob.class
to compile files used following command when in pacakagetester directory: javac -d bin -sourcepath source src/package*/* , works !
now how run hellob.class contains main method , has object of helloa.
i thought when @ packagetester directory, can do: java bin/packageb/hellob not work because cannot seem find .class file. appreciated figure out how execute file correctly
the root of bin should in classpath in order packageb.hellob found packageb/hellob.class while parsing classpath.
the easiest way change directory bin , execute java packageb.hellob there.
alternatively, can execute java -cp bin packageb.hellob packagetester directory, or somewhere else if replace bin absolute path.
Comments
Post a Comment