Solved

Setting the classpath by java.class.path variable.

Posted on 2001-07-03
2
240 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

706 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now