Solved

Setting the classpath by java.class.path variable.

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why my table column Id is not passed to java object? 4 46
mysql jsp example issue 32 75
Chrome and Firefox Java 5 69
jmss example java 2 34
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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 basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

730 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