The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2000

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:

Try this!!!

Posted by Kishori Sharan on November 27, 2000 at 10:03 AM

Hi
YOu don't need to set classpath for using jdk1.3 classes. When you install jdk1.3 then it makes an entry in registry about the home directory of jdk1.3 and at run time it reads that setting to read the jdk1.3 standard classes. So, you are right that classpath for jdk1.3 exists even if you delete all the classpath setting. I haven't worked in win2000 professional. Now you have three options .
1) Compile your java program with package in Jbuilder or whatever editor you are using and then go to DOS prompt ( i hope you can get to DOS prompt in win2000 ) and then give a command
java lu.ping.Test
where lu.ping is the package and Test is the class. Of course you need to set the class path. Optionally , you can also set the classpath at command prompt using -classpath switch.
2) Put your class in a package e,g lu.ping . Don't create a main method for this class. Event if you create a main method then don't try to run it. Now create another class , say, Test in which just import the classes from package lu.ping.* ; and then use the classes from the first program. Don't put the second program in a package. This way your first program is put in package and then you are calling its methods from second program which is not in a package.
3) At DOS prompt, use javac and java with -classpath options. Or, better create two .bat files and put the javac and java command in them with classpath. I think you can use $1 as a place holder for the argument and run these bat files to compile and run your java program. This way you don't have to enter the classpath everytime.
Thanx
Kishori



Replies:

Sponsored Links



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