• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java API class

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when we use any class from the Java API in our code, is that imported class get compiled?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I see what you mean.
 
reply
    Bookmark Topic Watch Topic
  • New Topic