Solved

Setting the classpath by java.class.path variable.

Posted on 2001-07-03
2
246 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
[X]
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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

734 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