I tried to run my java class generated using netbeans 10.0 in terminal as below:
~/Desktop/JavaLesson5/build/classes/javalesson5$ java javalesson5.JavaLesson5
but I keep getting the error below:
Error: Could not find or load main class javalesson5.JavaLesson5
Caused by: java.lang.ClassNotFoundException: javalesson5.JavaLesson5
My java code is as below:
package javalesson5;
import java.util.*;
import java.io.*;
public class JavaLesson5{
public static double myPI = 3.14159; //Class variable
public static int addThem(int a, int b){
double smallPI = 3.140;//Local variable
System.out.println("Local "+myPI);
int c = a + b;
return c;
}
public static void main(String[] args) {
System.out.println(addThem(1,2));
}
}