• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

View Of Native Functions of JAVA

 
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys, I have seen a function in System class mentioned below as :


could anyone tell me or guide me where these native function are written or can we have a look on that . I should mention that I am using JDK 1.4. Please help me out there are so many function which are native. I am basically understanding the Basic functionality of JVM. Thats why I really needed it. Please help me out.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Native methods in the JDK often provide an interface to functions in the operating system. Such functions, by their nature, cannot be reproduced by native Java code. System.currentTimeMillis() is an example of that. A few native methods in the JDK are things that could be done by native Java code, but are done as native methods for speed. System.arraycopy() is one of these.

I think one may be able to get hold of the source code of Sun's JDK. Of course, this is not in the Java source code that comes with the JDK. But I think you can get the native (C, C++ ...?) code somewhere. It will vary between platforms, of course. I seem to remember having to sign up to something, to get some source code for something else in the past. Sorry to be vague.

That said, I'm confused why you want this source code? Can you explain what you want to do with it?
 
Shaan Shar
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually I am trying to understand the JVM completly for that I have to understand the Native code too. Could you please specify from where we can get this native code.
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read The Java Virtual Machine Specification first.
 
Peter Chase
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ankur Sharma:
Actually I am trying to understand the JVM completly for that I have to understand the Native code too. Could you please specify from where we can get this native code.



I told you all I could remember. I'm not going to do a search that you could do.

Alternatively, maybe someone else knows?
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ankur Sharma:
Actually I am trying to understand the JVM completly for that I have to understand the Native code too. Could you please specify from where we can get this native code.



The Java source code is available from java.sun.com. Just look for source code SCSL.

A word of warning though... you have to know C.

Henry
 
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Uhmm... I couldn't help but say... When you say native functions, this is a term used in a non-oop perspective(or at least in java). If you're doing Java, I suggest you get used to the term "method". Because java is purely object oriented... There are no room for native functions but only object methods...
 
Sheriff
Posts: 28371
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ankur Sharma:
Actually I am trying to understand the JVM completly for that I have to understand the Native code too.

Do you mean you are going to "understand the JVM" by reading all the source code for all the classes in the standard Java API? There are over 12,000 classes in Java 5.
 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Actually I am trying to understand the JVM completly for that I have to understand the Native code too.



The JVM executes translates virtual machine instructions in to native machine instructions. Now you understand the JVM completely -- specific details notwithstanding.

I think if you seriously want to understand the JVM completely you should start with the general theory of operation and work your way down through specifics. You can understand the JVM completely without ever seeing a line of native code.
 
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
And I sure as heck don't see how seeing something like



is going to help you understand how the JVM works! (Disclaimer: I just made this up. Should be approximately right on a POSIX system though.)
 
Shaan Shar
Ranch Hand
Posts: 1252
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well ya this was I really want to check this will give me how the function is actually working. Thankx a lot for this stuff. Now if anyone know the actually source pls let me check. I am good enough in C in my knowledge atleast I can understand the code. If I have.
 
Ernest Friedman-Hill
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
Did you do what Henry said, way back toward the top of this thread, and look for "SCSL source code" at Sun's Java web site? In any case, the JDK 1.5 downloads page includes a link for the JDK source code, about halfway down.
 
I want my playground back. Here, I'll give you this tiny ad for it:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic