• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting Environment variable

 
jay thakkar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

CLASSPATH

C:\Program Files\apache-tomcat-7.0.39\lib\servlet-api.jar;D:\java_technology\programs
 
Mansukhdeep Thind
Ranch Hand
Posts: 1158
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
jay thakkar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
jay thakkar
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi JESPER

BTW here is the error you were asking for....

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic