I have the following structure...I tried to execute the HelloWorldApp.class file in exam directory by overiding the classpath but always I keep getting the beverage helloworldapp output nomatter what path I set.I tried a lot.It give an error saying class not found.If I take out the import statement from Study it executes the exam helloworldapp but either ways I found the classpath is not being overidden but it just identifies the "." for the current directory.It is not accessing the file I want it to like in SCJP6 by K&B Chapter 10 Developement
Test Question 9. Also I gave the
java command from the
c:\swathi\practice\classes it did not work. According to book it actually should please help me out .
I really appreciate your time and help.Thanks in advance to all of you on the ranch.
c:\swathi\practice\classes\exam\Study.class
package exam;
import exam.beverage.HelloWorldApp;
public class Study
{
public static void main(
String args[])
{
System.out.println("exam/Study");
new HelloWorldApp();
}
}
---------------------------------------------------------
c:\swathi\practice\classes\exam\beverage\HelloWorldApp.class
package exam.beverage;
public class HelloWorldApp {
public HelloWorldApp()
{
System.out.println("Beverage Constructor Hello World!");
}
public static void main(String[] args)
{
System.out.println("Hello World!"); // Display the string.
new HelloWorldApp();
// h1.HelloWorld();
}
}
------------------------------------------
c:\swathi\practice\classes\exam\HelloWorldApp.class
package exam;
public class HelloWorldApp {
public HelloWorldApp()
{
System.out.println("Exam Constructor Hello World!");
}
public static void main(String[] args)
{
System.out.println("Hello World!"); // Display the string.
new HelloWorldApp();
// h1.HelloWorld();
}
}
-------------------------------------------------------------
ashwathi