i wish to add external JAR to my project without using Eclipse GUI. i have a system variable which hold the absolute path to the JAR file, how may i add it using java code.
Share
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.
If you set the classpath variable then all other programs for which you dont specify a classpath while compiling or executing will assume the same classpath. This will result in an issue one way or the other. Like Snicolas said, its a very static way of doing things.
Instead what I would suggest is, if you have a variable like JAR_PATH set in your OS, then use the variable itself as below: