how to add my own class into a jar file?# Java - 爪哇娇娃
c*t
1 楼
for example, the structure in the jar file is
edu.cc.ffm. The name of the jar file is bc.jar
suppose my java file is hell.java
at the beginning of hell.java, I add
package edu.cc.ffm;
then use javac -classpath bc.jar hell.java to get hell.class
next I extract bc.jar and move hell.class to edu\cc\ffm
finally use jar cf bc.jar *.* to create a new bc.jar
My question is, when I use import edu.cc.ffm.hell;
it generates error saying import arguments are not correct.
can any expert tell me what's wrong
edu.cc.ffm. The name of the jar file is bc.jar
suppose my java file is hell.java
at the beginning of hell.java, I add
package edu.cc.ffm;
then use javac -classpath bc.jar hell.java to get hell.class
next I extract bc.jar and move hell.class to edu\cc\ffm
finally use jar cf bc.jar *.* to create a new bc.jar
My question is, when I use import edu.cc.ffm.hell;
it generates error saying import arguments are not correct.
can any expert tell me what's wrong