Solved

Setting the classpath by java.class.path variable.

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

System.setProperty("java.class.path","c:/java/sendFiles");

Is the above command sets the classpath forever ??? means will it sets for the current dos prompt forever ?
0
Comment
Question by:mzkhan786
2 Comments
 
LVL 3

Accepted Solution

by:
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);
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
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.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
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.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HashTable highest marks enumeration alternative 9 40
null output 3 25
JavaFX TableView not displaying correctly 3 21
String array comparison 4 34
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

825 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