How to set the path?
Solution:
You can set the path in two ways.
1.Set the path at command prompt.
set path = "%path%;.;JAVA_HOME\bin";
%path% tells that the old "path" variable values should be remained as it is and the new values should be appended to the old 'path'variable value.
"." represents the current directory
It is a temporary solution the path variable is available only for the current session,
that is till the command prompt is closed.
Ex: C:\Mydirectory\JavaPrgs>set path = %path%;.;C:\Java\Jdk1.5\bin"; where C:\Java is the installation folder for Jdk.15
2.Set the path in MyComputer Environment variable.
Right click on the MyComputer and select properties, select Advanced Tab and click on the EnvironmentVariables
In User variables click on the New and give the Variable name as "PATH" and enter the variable value as %path%;.;C:\java_home\bin; and click OK.
This is the permanent solution, this works fine till the java is there in the specified directory or the path variable available in the EnvironmentVariables.
How to set the classpath?
Solution:
Setting the classpath is very similar to setting the path variable.
This is also can be done in two ways.
1.Set the classpath at command prompt.
set classpath = "%classpath%;.;JAVA_HOME\lib";
%path% tells that the old "classpath" variable values should be remained as it is and the new values should be appended to the old 'classpath'variable value.
"." represents the current directory
It is a temporary solution the classpath variable is available only for the current session,
that is till the command prompt is closed.
Ex: C:\Mydirectory\JavaPrgs>set classpath = %classpath%;.;C:\Java\Jdk1.5\lib"; where C:\Java is the installation folder for Jdk.15
2.Set the classpath in MyComputer Environment variable.
Right click on the MyComputer and select properties, select Advanced Tab and click on the EnvironmentVariables
In User variables click on the New and give the Variable name as "CLASSPATH" and enter the variable value as %classpath%;.;C:\java_home\lib; and click OK.
This is the permanent solution, this works fine till the java is there in the specified directory or the classpath variable available in the EnvironmentVariables.
How to set the Tomcat configuration variables?
Solution:
To run the Tomcat server you have to configure two variables in the EnvironmentVariables
1. JAVA_HOME : this is the Java installation home directory.
To configure this variable; Right click on the MyComputer and select properties, select Advanced Tab and click on the EnvironmentVariables
In User variables click on the New and give the Variable name as "JAVA_HOME" and enter the variable value as C:\Java\Jdk.15;
(say java is installed in the C:\Java\Jdk1.5 directory) and click OK.
2. CATALINA_HOME : this is the Tomcat installation home directory.
To configure this variable; Right click on the MyComputer and select properties, select Advanced Tab and click on the EnvironmentVariables
In User variables click on the New and give the Variable name as "CATALINA_HOME" and enter the variable value as C:\Tomcat5.0;
(say java is installed in the C:\Tomcat5.0 directory) and click OK.
(If tomcat is installed in the C:\jakarta_tomcat\Tomcat5.0 folder then set the value to this)
How to set the classpath to jdbc thin driver(that is type-4 driver) for oracle?
Solution:
To use the jdbc thin driver for oracle the classpath has to be set to the classes_111.jar or classes_12.jar or ojdbc14.jar depending on the oracle version.
For oracle 10XE thin driver classes are available in the ojdbc14.jar, you can set classpath to this jar in the EnvironmentVariables.
Right click on the MyComputer and select properties, select Advanced Tab and click on the EnvironmentVariables,
if the CLASSPATH variable is already present click on the Edit and add the jar file path at the end of the classpath variable value.
Ex: %classpath%;.;C:\Java\Jdk1.5\lib;C:\oracleexe\app\oracle\product\10.20.0\server\jdbc\lib\ojdbc14.jar;
Depending on the oracle version search for the above mentioned jars and set the classpath to that jar as it is in the above example.
If the above mentioned jar names are in the zip format say classes_111.zip then rename the extension from zip to jar either directly or by
extracting then set the classpath to classes_111.jar
If your developing the application through the Eclipse or any other IDE add the jar in the classpath libraries in the below manner.
Right click on the project, select properties, select JavaBuildPath, select Libraries tab,click on the AddExternalJars button,
browse and select the jar click OK.
How to set the class path to run the servlets?
Solution:
1. Either set the class path to servlet-api.jar or j2ee.jar
2.Or add the jar to the class path of the project
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment