hello!I install tomcat server and set CLASSPATH variable servlet-api and my servlets running properly but when i compile and run my old program program of java 2 SE then it compile successfully but not run it prints an error message
Error: Could not find or load main class BinarySearchDemo
Press any key to continue . . .
i already said that my programs was running before normally but after tomcat installation this problem is arrise and more thing that when i delete my CLASSPATH then my all programs work properly as it should and my all variable are set like JAVA_HOME,CATALINE_HOME and CLASSPATHand for compilationPath
i think you are not understand that what i am said
i set total four variables
first is only for tomcat CATALINA_HOME CATALINA_HOME= " C:\apache-tomcat-8.0.15 "
second is also for tomcat JAVA_HOME JAVA_HOME= " C:\Program Files (x86)\Java\jdk1.7.0_45 "
third is for compilation of JAVA 2 EE programsCLASSPATH CLASSPATH=" C:\apache-tomcat-8.0.15\lib\servlet-api.jar "
and forth is compilation of my overall programs or JAVA 2 SE programePath Path=" C:\Program Files (x86)\Java\jdk1.7.0_45\bin "
now problem is that these variables are compile and run only servlet classes if i run only hello world program then it compile as well as but program give run time error message Error: Could not find or load main class BinarySearchDemo
when i remove CLASSPATH variable then program is run as well as but servlets are not run i want that servlets and other programs should run togather i think now it is clear
If you didn't have an explicit classpath then you had the default, which is the current working directory. Your new classpath does not include that value, so the current working directory is not in your new classpath, so your class file is not found.