Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

confuse in Class path ..?

 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
i had installed Jcreater in my system and i had setted only path variable up to bin directory of my jdk and i had not setted my calss path and java_home but when a compiler needs API of java in lib directory how come the compiler take class files in lib is JCreater is going to be handle or what?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49466
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I understand the question.

As far as I remember about JCreator, once you have given it the PATH to use when you configure it, it invokes the javac executable in your bin directory and that knows the CLASSPATH. I have never had to set a CLASSPATH when I used JCreator.
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what you are trying to say is that how does the compiler takes the jars(library files) in the lib folder when you've not set the classpath. Well you don't need to add the lib folder of your JDK to the classpath. The compiler implicitly uses the jars in the jdk lib directory while compiling. JCreator has no role in this...
 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply

Is it the same way the JVM will implicitly uses the jars in the jdk lib directory while running
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
santhosh.R gowda wrote:Is it the same way the JVM will implicitly uses the jars in the jdk lib directory while running


Yes. Class files/jar files etc.. used to compile the program is needed to run the program too.
 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Class files/jar files etc.. used to compile the program is needed to run the program too.


Thanks but i had seen so many books all are telling that we need to set path for operating system to search executable tools and classpath for the program to search class files...
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
santhosh.R gowda wrote: Thanks but i had seen so many books all are telling that we need to set path for operating system to search executable tools

Yes, you have to set the path for bin of the JDK which includes executables javac,java etc..
and classpath for the program to search class files...


Yes. Thats for everything other than core java libraries (third party libraries etc..) which are not included in the JDK.
 
santhosh.R gowda
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all of you for guiding me .... the isuue has been closed
 
Campbell Ritchie
Sheriff
Pie
Posts: 49466
64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
santhosh.R gowda wrote:Thanks all of you for guiding me .... the isuue has been closed
No, it hasn't.

Lots of books tell you about setting a classpath. Lots of people tell you about it too. And lots of them give unhelpful advice. The classpath varies from application to application, so you ought not to set a system-wide classpath, if your Java™ code works all right. Vijatha Kumara has given you the correct advice: you only need to specify a classpath if you are using additional jars, which you will probably not do until you start database programming.

If your Java™ programming has worked well without your setting anything in the classpath, then your classpath settings are correct already and will not need to be changed. If you start getting problems about ClassDefNotFound, it is worth checking the system classpath. If it doesn't contain . for "current directory" somewhere, add .; (Windows systems) or .: (Unix Linux or Mac computers) at the beginning of the classpath.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic