I’ve written a program in directory
C:\Program files\Java\jdk1.6\bin\
and I want to load a class from different location i.e.
D:\\MyProgs\
How should I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to set Path (environment variable) of
C:\Program files\Java\jdk1.6\bin. If you haveWinOS then open System Properties (Control Panel) + Advanced + Environment Variables) to set or create newPathvariable.If you want to run a class which is located at another folder then you have to use -classpath switch. In fact both, java compiler (javac.exe) and java launcher (java.exe) require the location of classes and you may specify using
-classpathor-cpswitch.For instance: