I am learning java at the moment and I am a bit confused on where or how to set a class path?
I am using Jcreator Pro.
Do I set it in the source file or in the IDE or in Windows somewhere?
Any help would be greatly appreciated.
I am learning java at the moment and I am a bit confused on where or how to set a class path?
I am using Jcreator Pro.
Do I set it in the source file or in the IDE or in Windows somewhere?
Any help would be greatly appreciated.
You can set it in a few places :-)
You set it in your IDE so you can compile and run from within that environment. I'm not familiar with JCreater, but I suspect like most IDEs it has already set the classpath for you. It will be set to the directory where JCreator writes classes to. If you are using 3rd-party JARs, they too need to be on the classpath. In your IDE, you would likely have to add them manually (look for "add JARs" or "add libraries" or similar).
You can also set the classpath when running the java compiler or runtime (javac and java) from the command line. You do this with a "-cp" parameter followed by the list of directories and JARs you wish to have on the classpath.
There are other places to set classpaths as well. If you build with something other than an IDE (like with Maven or Ant, two popular build tools), you would need to set the classpath using the ways they specify.