This page contains an archived post to the Java Answers Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
Thanx
Posted by siva on December 27, 2000 at 9:52 AM
Thanx for your answer.It is now working. I have more doubt in importing packages I have already set class path"c:\siva\java"as you mentioned.Both package1,pacakge2 are in the directry c:\siva\java pacakge package1; public class Box { public Box(int a, int b){ int len = a; int wid = b; } } I stored this file in package1 directry Then the next file is in package2 import package1.*; public class Test { public static void main(String[] args){ Box box= new Box(2,4); } } When compiling both files ,no error message.But when the Test.class is run using the command "java package2.test" excption message comes the message "Exception in thread "main" java.lang.NoClassDefFoundError:package2/Test(wrong name:Test)" Could you give reason for this? Thanx Siva
Replies:
|