LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   how does java interact with linux user space application. (https://www.linuxquestions.org/questions/programming-9/how-does-java-interact-with-linux-user-space-application-840815/)

nakul.k1 10-27-2010 02:37 PM

how does java interact with linux user space application.
 
Hello every one

As i see most of the userspace application code is in java which will call the user space C or C++ application that will interact with kernel space linux code by system call.

now my doubt is how does this java application interact with linux user space application.

for example:
On android mobile if one wants to see SIM contacts all he does is just go to phone book contacts which is a java application and needs to interact with a user-space application which will transfer the control to kernel space to reads a SIM phone book contact.

now my doubt is:
how does this java application communicate with linux user space applications.


NRK

acid_kewpie 10-27-2010 03:27 PM

Please use better thread titles if you expect to get help on a public forum. Title changed.

paulsm4 10-28-2010 02:09 PM

Hi -

1. The intent in Java is to insulate you in your "own little world". You're strongly discouraged from stepping outside that little world (the Java virtual environment; the Java API) unless you absolutely must.

2. One common way for Java programs to access the "outside world" is by using Runtime.exec(). For example, you can get a process listing via "Runtime.exec ("ps -ae")".

3. Another, more difficult way, is for Java to access C libraries directly. This is done using JNI.

4. All of the above applies to Windows, Linux and MacOS.

Things are a little different for Android, however.

The Linux kernel in Android is much slimmer than a Linux desktop kernel; the Dalvik JVM is much, much closer integrated to the kernel (and the underlying hardware) than a "normal" J2SE JVM running in a "normal" Linux kernel.

5. If you want to experiment with Android, you should download the Android SDK stick with the (higher-level) Java API has much as you can, for as long as you can. It's more practical, you'll be more productive - it just makes more sense.

IMHO...


All times are GMT -5. The time now is 05:19 PM.