Setting the classpath by java.class.path variable.

Posted on 2001-07-03
Last Modified: 2008-03-03
When i set the classpath through following command
it didn't work ?


Is the above command sets the classpath forever ??? means will it sets for the current dos prompt forever ?
Question by:mzkhan786
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

dnoelpp earned 25 total points
ID: 6248708
It doesn't make sense to set the class path programmatically this way. So you have two possibilities:

1. If you want to set the classpath forever, then you should edit the environment variables of your OS. How, that depends from the Windows variant you use. Generally said: set the CLASSPATH environment variable to the values you want. Please tell us what OS you use.

2. If you want to programmatically load Java classes from locations outside the classpath, then use the URLClassLoader. Like this:

ClassLoader loader = new URLClassLoader(new URL[] { yourURL });
Class clazz = loader.loadClass(yourClassName);
LVL 14

Expert Comment

ID: 9017949
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

[points to dnoelpp]

Please leave any comments here within the next seven days.
EE Cleanup Volunteer
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question