Up until now I have relied on my Java Editor (JCreator Pro) to handle my java compiling. I am now trying to learn how to do it all from the command line so that I will be able to work on any platform. I know the basic command options for compiling and running a java program. However, the classpath option is confusing me a little. I know that java -classpath path_to_extra.jar myFile.java will compile my java file using path_to_extra.jar to search for external class libraries that I have included that are not part of the standard JDK. Now, when I launch this application, and I use the -classpath with the java command, does it work the same? Do I even need to include it? Or does using this tag used with the JAVA command over-ride the compilers default package search? Thanks for any help.
Joined: Mar 26, 2002
Gregg I, too, have had difficulties navigating the nuances of classpath and sourcepath. This doesn't specifically answer your question, but it might be helpful. I avoid the classpath issue entirely by dumping any extra jar files I need into the following folder: [JDK home]\JRE\lib\ext. By placing your jar files in that folder the compiler will recognize those files without you having to change your classpath setting. I'm sure that I will eventually discover that there is a drawback to this technique, but it has helped me get around the classpath issue. If anyone thinks that this solution is terrible, please let me know. [ April 09, 2002: Message edited by: Dave Winn ]