B
Baba
OK. Here's the thing.
My env is CLASSPATH=C:\javaExercise
My source and classes are in C:\javaExercise\mypackage
Source looks like this (shortened)
package mypackyge;
public class MyClass {
public void printMe(String s) {System.out.println(s)}
public static void main(String args[]) {
MyClass myclass=new MyClass();
myclass.printMe("Hi!");
}
}
I can compile this, but on running it it throws an ClassDefNotFound
exception on the first line of the main method. Why? Is it not possible to
have a main method in a class inside a package?
I'm kinda confused where I err. So, can anyone please help me?
My env is CLASSPATH=C:\javaExercise
My source and classes are in C:\javaExercise\mypackage
Source looks like this (shortened)
package mypackyge;
public class MyClass {
public void printMe(String s) {System.out.println(s)}
public static void main(String args[]) {
MyClass myclass=new MyClass();
myclass.printMe("Hi!");
}
}
I can compile this, but on running it it throws an ClassDefNotFound
exception on the first line of the main method. Why? Is it not possible to
have a main method in a class inside a package?
I'm kinda confused where I err. So, can anyone please help me?