• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java API class

 
Rajat Sarkar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when we use any class from the Java API in our code, is that imported class get compiled?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The classes live in a file called rt.jar (or similar) and they have already been compiled before you downloaded them.
 
Matteo Di Furia
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it should be yet compiled into some jar. At runtime, you must have that same jar in your classpath for the execution to run properly (which is mostly the case, since standard APIs are included in the classpath when you launch your application).

[Edit : eh, Campbell was faster !]
[ October 15, 2008: Message edited by: Matteo Di Furia ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Matteo Di Furia:
At runtime, you must have that same jar in your classpath.


Where the rt.jar file is placed, that is somewhere that the JVM always looks for .jar files anyway, so you don't add anything to your CLASSPATH in this instance.
 
Matteo Di Furia
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:


Where the rt.jar file is placed, that is somewhere that the JVM always looks for .jar files anyway, so you don't add anything to your CLASSPATH in this instance.


That's what I was trying to explain in the sentence in brackets ^^
[ October 15, 2008: Message edited by: Matteo Di Furia ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I see what you mean.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic