Thursday, March 6, 2014
How to Set Up Java Classpath on Windows
Option to Java SDK Tools
1. Type the Java SDK tool command on the Windows command line. For example, if you are compiling code, type 'javac' at the command prompt (shown here as 'C:>'):C:> javac
2. Add a space after the SDK tool command name and type '-classpath' followed by another space to start the classpath option. Continuing the earlier example:C:> javac -classpath
3. Type the path to your classes. If your classes are stored in a folder, type the full path of the folder. For example:C:> javac -classpath C:\project\classesIf your classes are stored in a JAR or ZIP file, type the full path to the file, including the file name. For example:C:> javac -classpath C:\project\classes\myclasses.jarSeparate multiple paths with a semicolon (';'). For example:C:> javac -classpath C:\project\classes\;C:\thirdparty\classes\game.jarJava will use the first matching class it finds as it searches each path.
4. Add any additional options needed to complete the SDK tool command and hit 'Enter' to run the tool. The SDK Tool will used the paths your provided to find the classes needed to execute the command.
Windows XP Environment Variable
5. Right-click 'My Computer' on the desktop or in the Start menu. A pop-up menu appears near your mouse cursor.
6. Select 'Properties' from the menu. The 'System Properties' window opens.
7. Click the 'Advanced' tab.
8. Click the 'Environment variables' button near the bottom of the window.
9. Click 'New' under 'User variables.'
10. Type 'classpath' for the 'Variable name.'
11. Type the full path to your Java classes for the 'Variable value.' Separate multiple paths with a semicolon (';').
12. Click 'OK' to add the new classpath variable.
13. Click 'OK' to close the 'System Properties' window.
Windows Vista or Windows 7 Environment Variable
14. Right-click 'Computer' on the desktop or in the Start menu. A pop-up menu appears near your mouse cursor.
15. Select 'Properties' from the menu. The Control Panel 'System' window opens.
16. Click the 'Advanced system settings' item on the left side of the window. The 'System Properties' window opens with the 'Advanced' tab visible.
17. Click the 'Environment variables' button near the bottom of the window.
18. Click 'New' under 'User variables.'
19. Type 'classpath' for the 'Variable name.'
20. Type the full path to your Java classes for the 'Variable value.' Separate multiple paths with a semicolon (';').
21. Click 'OK' to add the new classpath variable.
22. Click 'OK' to close the 'System Properties' window.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment