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.
public class Study
public static void main(String args)
I had used c:\swathi\practice\source javac -d ../classes exam.Study.java to create the class files under c:\swathi\practice\classes\ exam with same directory structure above follwoing the package structure
Now as per norms we should be running the files from classes so I used c:\swathi\practice\classes java exam.Study
So this started using the HelloWorldsApp file in beverage since its importing it from beverage. But I want the Study.java to use the HelloWorldApp file in the exam package. I tried overriding it
either ways its executing the beverage.HelloWorldApp file.
1)Is the import statement problematic or what is the issue?
2)If I delete the import statemnt Study is using exam/HelloWorldApp file am unable to force it to use beverage.HelloWorldApp file.
3)Am I executing the command from wrong directory I mean It should work from classes package right.Once we define a package for class files like package classes we can call jvm from classes package right or should we alsways use source package even while running them. I mean once class files are created from where are we usually supposed to call/run the class file source or classes package..
I really appreciate all your time and help.I have also added the same directory structure a source and classes attachments....please review them if the above picture is not clear.
Thank you all ranch.....for sparing your precious time for me.