• 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

About rt.jar and inside Java Libraries

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

1) Can you please explain me what is the use of rt.jar file in java.

2) When I open any of the class file from rt.jar, which give method signatures only.. no method had implemented code? What is the reason behind this *.class file was designed like in that way.

suppose, If I write Math.abs(123) in my java source file, where exactly we can find the code for abs function.

please elabrate briefly?


Thanks.
Uday
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look for a file called src.zip in your Java home. It contains the source code.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
rt.jar is the JAR file that contains the class files of the standard Java SE API classes and interfaces. The "rt" stands for "runtime".
 
UdayK Kumar
Greenhorn
Posts: 26
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:Look for a file called src.zip in your Java home. It contains the source code.




Thanks for your reply. Actually my doubt is , Suppose, when we are executing one method on Thread class, like fine current thread, i m not able to fine the implementation code the for that method.. please have look on the methods defined in Thread.class @src.zip file as below,

/**
* Returns a reference to the currently executing thread object.
*
* @return the currently executing thread.
*/
public static native Thread currentThread();

/**
* Causes the currently executing thread object to temporarily pause
* and allow other threads to execute.
*/
public static native void yield();


I know these are native methods, so don't we have code for these?

Thanks
Uday


 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"native methods" are methods whose bodies are not implemented in Java, but in some other language (typically C/C++ or assembler). They're part of the source code of the JVM itself. You can get Sun's JVM source code from the Java download page, down in the "Additional Resources" section. It's unlikely that the C source for these particular methods will do you much good, as they're just going to be a thin wrapper around the operating system's versions of the same thing.
 
reply
    Bookmark Topic Watch Topic
  • New Topic