classpath - Java: Error: Could not find or load main class -


i trying call java code executable. java code follows:

costcalculatortype.java:

public interface costcalculatortype {     public double calculatecost(double[] chromosome); } 

main.java:

import org.plyjy.factory.jythonobjectfactory;  public class main {      public static void main(string[] args) {         double[] = new double[]{1.3653333, 0.0000000, -1.8204444, -1.8204444};  double result;          jythonobjectfactory factory = jythonobjectfactory.getinstance();         costcalculatortype costcalc = (costcalculatortype)             factory.createobject(costcalculatortype.class, "costcalculator");         result = costcalc.calculatecost(a);         system.out.println("result = "+result);     } } 

when run following commands, desired output:

javac -cp ".:/home/ch/plyjy.jar:/home/ch/jython.jar" costcalculatortype.java main.java  java -cp ".:/home/ch/plyjy.jar:/home/ch/jython.jar" costcalculatortype.java main  result = 3324.260315871956 

however, when set classpath , run following commands, error.

 export classpath=/home/ch/jython.jar:$classpath  export classpath=/home/ch/plyjy.jar:$classpath  javac costcalculatortype.java main.java   java main   error: not find or load main class main 

i want able without using -cp option because, want strip off main method, move different method and, call different program. how can desired output without using -cp option?

you need add classpath directory own sources reside.

if current directory, then

export classpath=.:$classpath


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -