hi all,
I am running a servlet on apache server in window 7. I am calling a java class from servlet. But what is problem with me. I compiled my java class fine which been called from servlet then after i try to compile to servlet but this time i got an error from compiler for servlet file is that:
java class (class name here) file not found (for which i am creating object in servlet file)
i am getting errors in all line where i created object to invoke the java class file because specific java file is not found by compiler. both file are in same folder on server c:\.................../WEB-INF/classes
please help me what should i do....
I am running a servlet on apache server in window 7. I am calling a java class from servlet. But what is problem with me. I compiled my java class fine which been called from servlet then after i try to compile to servlet but this time i got an error from compiler for servlet file is that:
java class (class name here) file not found (for which i am creating object in servlet file)
i am getting errors in all line where i created object to invoke the java class file because specific java file is not found by compiler. both file are in same folder on server c:\.................../WEB-INF/classes
please help me what should i do....
Hi
ReplyDeletebasically you have problem in window 7 calling java class file from another class file which is majot issue of window 7.
But now you are calling the java class file from servlet:
to do this do following
1. go to the classes folder or where you palced your java files and then try to compile following command to compile
command:
javac -cp . *.java
or
javac -classpath . *.java
what this command is doing telling the java compiler
to search all the java files in same folder
if you still stuck use the second method
2. second way to leave this code you have to copy the
path of your java file where you placed it and trying
to compile it. after copying the path add it into the
the classpath using the command prompt and use the
following command :-
set CLASSPATH = .; ;
here (.) is previous path and (;) is seprated which means it will also save the previous path and also add new path of your folder
now here is one more issue don't forget to place all following variables and path like:
CLASSPATH, PATH, JAVA_HOME,JRE_HOME
in system variable section
in environment vaiables
when setting the environment variables if want to see how to set the variable path visit following link
http://javatechandsupport.blogspot.in/2012/07/java-server-problem-in-window-7.html
what is issue here with this trick is this path will work for all users presents on yours OS
if we place these variables path in
user variables
it will work only for current user your are setting the path for