2

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.

1
  • you will set it in the IDE. googling on how to do it didnt turn up anything promising. Good luck. Commented Sep 16, 2009 at 3:33

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.