Hi,
I have created a class in a package called newtest and I have saved it as D:\newtest\someException.java and compiled and no errors,
package newtest;
public class someException extends Exception
{
String errorcode;
String errordesc;
public someException(String ecode,String edesc)
{
errorcode = ecode;
errordesc = edesc;
severity = sev;
}
public String geterrorcode()
{
return errorcode;
}
}
but when I want to use the package in another normal java program which is stored in D:\testing\test\test.java.
It's giving NoClassDef found runtime errors.It's compiling properly when give
javac -classpath D:\newtest; test.java
import newtest.*;
class test
{
public static void main(String[] args)
{
try
{
throw new someException("100","Hello","world");
}
catch(someException e1)
{
String s1=e1.geterrorcode();
System.out.println(s1);
}
}
}
Can anyone tell me how to use packages and set classpaths without these problem