• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting Environment variable

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1164
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi JESPER

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

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic