aspose file tools*
The moose likes Beginning Java and the fly likes setting Environment variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "setting Environment variable" Watch "setting Environment variable" New topic
Author

setting Environment variable

jay thakkar
Greenhorn

Joined: Mar 15, 2013
Posts: 9
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

Joined: Jul 27, 2010
Posts: 1157

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?


~ Mansukh
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14352
    
  22

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
jay thakkar
Greenhorn

Joined: Mar 15, 2013
Posts: 9
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

Joined: Mar 15, 2013
Posts: 9
hi JESPER

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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting Environment variable