In Java, you can set the CLASSPATH variable.
Application ClassLoader uses CLASSPATH as an environment variable to locate and load .class files. The CLASSPATH specifies the location of third-party and user-defined classes that are not extensions or components of the Java platform. When setting the CLASSPATH, make sure to include all directories that contain .class files and JAR files.
If the following conditions apply, you must set the CLASSPATH:
A dot is the default value for CLASSPATH (.). It refers to the only directory that is currently being searched. When you set the CLASSPATH variable or use the -classpath command, the default value of CLASSPATH takes precedence (for short -cp). If you want to include the current directory in the search path, add a dot (.) to the new setting.
There are two ways to ways to set CLASSPATH: through Command Prompt or by setting Environment Variable.
Step 1: Click on the Windows button and choose Control Panel. Select System.
Step 2: Click on Advanced System Settings.
Step 3: A dialog box will open. Click on Environment Variables.
Step 4: If the CLASSPATH already exists in System Variables, click on the Edit button then put a semicolon (;) at the end. Paste the Path of MySQL-Connector Java.jar file.
If the CLASSPATH doesn’t exist in System Variables, then click on the New button and type Variable name as CLASSPATH and Variable value as C:\Program Files\Java\jre1.8\MySQL-Connector Java.jar;.;
Remember: Put ;.; at the end of the CLASSPATH.
Type the following command in your Command Prompt and press enter
set CLASSPATH=%CLASSPATH%;C:\Program Files\Java\jre1.8\rt.jar;
The set command is an internal DOS command that allows the user to change the variable value in the above command. CLASSPATH is the name of a variable. The variable enclosed in the percent sign (%) is already present in the environment. The semicolon is a separator, and the PATH to the rt.jar file is after the (;).
Note: also read about the What is Java programming language
If you like my post please follow me to read my latest post on programming and technology.
https://www.instagram.com/coderz.py/
https://www.facebook.com/coderz.py
Staying up to the mark is what defines me. Hi all! I’m Rabecca Fatima a keen learner, great enthusiast, ready to take new challenges as stepping stones towards flying colors.
Problem Statement: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example…
Given an integer A. Compute and return the square root of A. If A is…
Given a zero-based permutation nums (0-indexed), build an array ans of the same length where…
A heap is a specialized tree-based data structure that satisfies the heap property. It is…
What is the Lowest Common Ancestor? In a tree, the lowest common ancestor (LCA) of…