I was practicing this package example from "java2 complete refrence" package cert.java; class Balance { String name; double bal; Balance( String n, double b ) { name = n; bal = b; }
class AccountBalance { public static void main(String args[]) { Balance current[] = new Balance[3]; current[0] = new Balance("prahant" , 4000); current[1] = new Balance("chaita" , 5000); current[2] = new Balance("usha" , 6000); for(int i = 0; i < 3; i++)<br /> {<br /> current[i].show();<br /> }<br /> }<br /> }<br /> <br /> I have a directory in my C: named c:\cert\java; the source and class files are included in the <br /> same directory but when i try to execute the class file using <br /> 1) C:\cert> java java.AccountBalance -- as described by "patrick" go one level up and execute the class file. 2) c:\cert\java> java.AccountBalance.-- give the same exception noclassdeffounderror. now i even tried setting the classpath variable to
set classpath=C:\cert\java; C:\jdk1.2.2\lib\tools.jar; C:\jdk1.2.2\lib\dt.jar; this is silly but do i have to specify the jdk path Please explain me why the classpath is classes the classpath "variable"
prashz
CSR Rao
Greenhorn
Joined: Mar 31, 2007
Posts: 6
posted
0
The accountbalance class should have a package statement. package cert.java;
Regards,<br />CSR.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.