hello pals.... i m new to java world and trying hard to learn it
i m learning servlets and i came to know that proctected method in abstract class can be overridden in subclass as public which was something new to me.. so i made my mind to check myself and i wrote a program given below
and i got some error saying that "cant load class" for you.. so i set the variable throught "advanced system setting" window in WIN 7.. still it is not working.. why so ???
CLASSPATH variable is set to the value as given below
servlet-api.jar is required for running servlets inside a container such as tomcat, not for running plain java classes like these. Where is the public class in your source file? How will the JVM load the class with the main method if it is not public? Lets go step by step. You are getting ahead of yourself. Do one thing. Write a simple java class using notepad++ or any text editor, NOT an IDE, to print "Hi " on the command prompt. Can you do that successfully?
jay thakkar wrote:and i got some error saying that "cant load class" for you..
Please copy and paste the exact error question instead of giving a vague description of what the error is - the error message most likely tells you exactly what's happening. If you tell us, we can tell you what it means, so you can solve the problem.
hey manshukh...... thanks for your reply , it was valuable.. yes i can use IDE but i am not using 1 cause i want to learn all things manually that is why i found JAVA harder then .net.... yes i can run programs with the help of JDK tools(java , javac).....
my question is does setting classpath like given below effect the CLASSPATH variable you set by "advanced system settings" window in win 7 , if it does change the environment variable then my program should not work but it is not changing the CLASSPATH variable in "advanced system settings" window in win 7. so my program should work na ???
c:> set CLASSPATH="path"
c:> JDKTOOL -classpath "path" "some class file"
other question is that "the CLASSPATH variable which i created myself as per a servlet BOOk , and i m setting it does not change so i must be changing some other variable through commands.. so i guess there are 2 CLASSPATH variables ??? 1 )user defined and 2) system defined
please correct if i am wrong.... i will like to know in detail about this topic