java Error while running class -
this question has answer here:
my directory structure this
/models/beamcalculate.java /lib/*.jar ---------all jar files here.
the beamcalculate.java --
package models; import com.fasterxml.jackson.databind.objectmapper; public class beamcalculate{ private double width; private double depth; private double m; private double mcap; public static void main(string args[]){ objectmapper = new objectmapper(); } }
the thing gets compiled command --
javac -cp "lib/*" models/beamcalculate.java
this generates beamcalculate.class file in models/
but when try run using command --
java -cp "lib/*" models/beamcalculate.class error - error: not find or load main class models.beamcalculate.class
what causing this?
you don't add .class
suffix when run java
command. shouldn't use /
in full class name separate packages .
. try
java -cp "lib/*" models.beamcalculate
also may need add current location classpath maybe try adding .
java -cp ".;lib/*" models.beamcalculate
or
java -cp ".:lib/*" models.beamcalculate
depending on operation system.
Comments
Post a Comment