The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

CLASSPATH problem

Posted by Kishori Sharan on April 28, 2001 at 3:58 PM

Your class is defined as:

package plugins ;

class Abc {
}

and you are placing .class file as /plugins/Abc.class . Now in another Java class you want to use Abc class as

import plugins ;

.....
use Abc class
.....

For this to work your classpath must include / ( i.e. root directory). To check what is set in your class path just write a simple class and try to print classpath setting using:

System.out.println ( System.getProperty ( "java.class.path" ) ) ;

This will give you clue what is going wrong with classpath setting. Or, on command prompt try compiling your second java file as:
javac -classpath / your_second_java_file
and run it as
java -cp / your_second_class_name

Thanks
Kishori



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us