Unix System Calls using Java

Hi!
Can anyone tell me how to do Unix System Calls in my Java program?
If possible please give me the java code for it taking one unix system call as an example.
Thanks in advance
Raj

do you mean firing off a shell command, or making actual kernel API calls or C library calls?
for shell commands, have a look at Runtime.exec(). for kernel calls, use JNI. the JNI FAQ mentions something called "shared stubs" that may be of use:
http://java.sun.com/products/jdk/faq/jnifaq.html
cheers,
p

Similar Messages

  • How do i make UNIX system calls in Java app?

    Is it possible to make UNIX system calls in a java app? I.E. perform a file copy/move to another machine within a program.
    Thanks,
    Erik

    If there is a command line tool then you use Runtime.exec() otherwise you have to use JNI.
    If you want to access shared libraries you might want to look at www.swig.org

  • System id using java

    how to get system id using java ,also MAC address?

    I think you have to use JNI and write the native calls on whatever platform(s) you need this.

  • How to access system calls from java program?

    i am having a doubt regarding accessing system calls from a Java program like accessing unix system calls from a c program.

    Runtime.getRuntime().exec("line command here");
    example:
    Runtime.getRuntime().exec("ls -la");

  • Monitor Unix Mail Queue using java

    Hi! ,
    I want to monitor unix mail queue using java. how can i proceed..
    Please advice..
    Thanks..
    Ganesh

    Google and see if there is an API which lets you monitor it.
    Kaj

  • How to read system eventlog using java program in windows?

    How to read system eventlog using java program in windows?
    is there any java class available to do this ? or any one having sample code for this?
    Your friend Zoe

    Hi,
    There is no java class for reading event log in windows, so we can do one thing we can use windows system 32 VBS script to read the system log .
    The output of this command can be read using java program....
    we can use java exec for executing this system32 vbs script.
    use the below program and pass the command "eventquery"
    plz refer cscript,wscript
    import java.io.*;
    public class CmdExec {
    public static void main(String argv[]) {
    try {
    String line;
    Process p = Runtime.getRuntime().exec("Command");
    BufferedReader input =
    new BufferedReader
    (new InputStreamReader(p.getInputStream()));
    while ((line = input.readLine()) != null) {
    System.out.println(line);
    input.close();
    catch (Exception err) {
    err.printStackTrace();
    This sample program will list all the system log information....
    Zoe

  • How to read system evenlog using java program in windows

    How to read system evenlog using java program in windows???
    is there any java class available to do this ? or any one having sample code for this?
    Your friend Zoe

    Welcome to the Sun forums.
    >
    How to read system evenlog using java program in windows???>
    JNI. (No.)
    >
    is there any java class available to do this ? or any one having sample code for this?>You will generally get better help around here if you read the documentation, try some sample code and come back with a specific question (hopefully with an SSCCE included).
    >
    Your friend Zoe>(raised eyebrow) Thank you for sharing that with us.
    Note also that one '?' denotes a question, while 2 or more generally denotes a dweeb.

  • Stoping System Clock using Java code.

    Is it possible to do so if yes then some code idea for
    Stoping System Clock using Java code.
    [email protected]

    The system clock is controlled from the BIOS, and as such, I don't think even windoze can stop it, though it can be continually reset. I don't believe that Java provides a sufficiently low level of control to set the system clock, although you could use a native method to accomplish the task.
    Why would you want to do such a thing?

  • Set system classpath using java program??

    Hi,
    I want to set the System classpath using java program. Can somebody please tell how to do this.
    Prashant

    but this will set the classpath for that particular JVM only.
    Isn't it??? I want that of SYSTEM so that user can access that class path from any JVM instance.
    Prashant

  • System configuration using java

    Hi friends
    Can I get System configuration using java code.
    If yes plz suggest how.
    thanks in advance.. Anjana

    some bits and pieces are available see the details in
    System.getProperties():
    Properties sysProps  = System.getProperties();
    meration en       = sysProps.keys();
    while ( en.hasMoreElements() )
    //add the key=value pairs
    Object keyObj    = en.nextElement();
    String key       = ( String ) keyObj;
    Object valueObj  = sysProps.getProperty( key );
    System.out.println( key + " : " +
    + valueObj.toString());
    de]
    just an idea??YES, and also you can do
    System.getenv();but they also don't give all the info the OP was/is looking for.

  • Internal system call used by "ps" command

    Hi All,
    Can any one let me the internal system call used by "ps" command to retrieve the process information. I want to use the same system call in my program to get list of information about processes currently running in the system. I do not want to use the "ps" command in my code.

    Justin_Samuel wrote:
    Hi All,
    Can any one let me the internal system call used by "ps" command to retrieve the process information. I want to use the same system call in my program to get list of information about processes currently running in the system. I do not want to use the "ps" command in my code.You can access the /proc filesystem for getting information about
    processes, even more than is available via ps.
    Have a look at:
    man -s 4 proc

  • How to invoke Default printer of my system by using java application

    I need to invoke default printer of my system by using java application ? could u plz help me out with sample code?

    VoodooMagic.getDefaultPrinter().print();
    http://www.javaworld.com/javaworld/jw-10-2000/jw-1020-print.html
    Look for more at Google.

  • How can i get system variable using java

    Hi,
    I just want to know how can i get system variables using java code.
    for example i want to get the the date for today or i want to get the number of processes that's running.
    Thanks alot

    Hi,
    I just want to know how can i get system variables
    using java code.
    for example i want to get the the date for today or i
    want to get the number of processes that's running.
    Thanks alotSome generic "system variables" are available though Java, usually through the System class.
    Date today = new Date();
    is instantiated with the current date and time.
    Other system values, like environment values, should be passed to java through the command line (-D option) by setting system properties.
    Finally, platform specific values like the number of processes running will have to be written in platform specific code and executed by JNI (java native interface).
    Java is platform or system agnostic. Common system values, like time, are implemented. Hopefully you won't need platform specific values.

  • Can i change system time using java

    hi guys can i change system time using java iam doing one app in that i have to change the system time (my os is windowsXP) please tell me how to change the time

    What does this have to do with Swing?
    Well, there is no Java API that I'm aware of.
    However you can execute any Windows command by using the Runtime class. So you should be able to invoke the Time command.
    Search the Java Programming forum. There are plenty of examples on using the Runtime.exec(...) command.

  • Unix system() system call in Java

    Hi,
    system() call in Unix is very helpfull when you need to implement a piece of code that is already implemented in an exsiting utility.
    Is there a way to achive a similar functionality?
    To put it in simpler words - is there a way, in Java, to call some method that will invoke a Unix shell and will execute the command specified in the string that is past in?
    Could you please CC the reply to [email protected]
    Thanks,
    -Michael

    Runtime.exec()
    > Could you please CC the reply to [email protected]
    Certainly not.

Maybe you are looking for

  • I lost my itunes media folder how can I export the photos from my ipad to another location

    I lost my itunes media folder and also my iPhoto files. I have the majority of the photos from iPhoto library on my iPad. How can I get them from my iPad to another location. Like exporting them to a folder on an external drive.Is this possible. I kn

  • Creation  of PO with reference only

    Dear Fiends, Can anyone explain,how can we make creation of PO with Reference to PR mandatory for Certain documents types of PO. Regards SAPMM

  • Organizing in iPhoto

    Hi, I am new to iPhoto I am trying to organize my pictures but I am not sure how to start.  I am not to familiar with iPhoto and wanted to read some suggestions.  Folders and Albums:  how to organize pictures either in folders or albums?  What is the

  • File receiver problem

    Hello all, Is there anyone who faced the below error, "NameNotFoundException: Object not found in lookup of FTPUtility". I am having the IDOC to File scenario. My file is getting processed but at the end it is giving this exception.

  • Movie fps VS playing fps in quicktime inspector

    using a 30FPS movie as example... movie fps is the real FPS of movie. playing fps is the FPS of: A. the movie actual playback FPS (meaning even though it says 30 FPS it might not be) B. the movie is indeed 30FPS but playback FPS is just FPS of playba