Preview

Java Native Access

Satisfactory Essays
Open Document
Open Document
266 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Java Native Access
Java Native Access import com.sun.jna.Library; import com.sun.jna.Native; import com.sun.jna.Platform; /** Simple example of native library declaration and usage. */ public class HelloWorld { public interface CLibrary extends Library { CLibrary INSTANCE = (CLibrary) Native.loadLibrary( (Platform.isWindows() ? "msvcrt" : "c"), CLibrary.class); void printf(String format, Object... args); } public static void main(String[] args) { CLibrary.INSTANCE.printf("Hello, World\n"); for (int i = 0; i < args.length; i++) { CLibrary.INSTANCE.printf("Argument %d: %s\n", i, args[i]); } } }

import com.sun.jna.Library; import com.sun.jna.Native; /** Simple example of native C POSIX library declaration and usage. */ public class exampleOfPOSIX { public interface POSIX extends Library { public int chmod(String filename, int mode); public int chown(String filename, int user, int group); public int rename(String oldpath, String newpath); public int kill(int pid, int signal); public int link(String oldpath, String newpath); public int mkdir(String path, int mode); public int rmdir(String path); } public static void main(String[] args) { POSIX posix = (POSIX) Native.loadLibrary("c", POSIX.class); posix.mkdir("/tmp/newdir", 0777); posix.rename("/tmp/newdir","/tmp/renamedir"); }
}

import com.sun.jna.Library; import com.sun.jna.Native; /** Simple example of Windows native library declaration and usage. */ public class BeepExample { public interface Kernel32 extends Library { //

You May Also Find These Documents Helpful

  • Satisfactory Essays

    IT210 Week 3

    • 756 Words
    • 4 Pages

    Resources: Review the example in Appendix E and the additional examples on pgs 80-83 of Prelude to Programming…

    • 756 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    PRG/420 Week 3

    • 1025 Words
    • 5 Pages

    /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package commission2; import java.lang. *; import java.text. DecimalFormat; import java.util.…

    • 1025 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    Pt1420 Unit 1 Assignment 2

    • 1305 Words
    • 6 Pages

    Hosch, L., Liesandthem, G., Luebring, J.E., Pallardy, R., Young, G. (2014). Java. In Encyclopedia Britannica.…

    • 1305 Words
    • 6 Pages
    Powerful Essays
  • Powerful Essays

    It is made up of a group of libraries running as a layer on top of the operating system which programmers can call on to add functionality to the program they are writing. It uses applications such as printing, mouse clicks, data saving, copy, paste and many more. The main advantage of these libraries are that they are already written, debugged and backwards compatible with older versions of programs using the .NET framework.…

    • 1025 Words
    • 5 Pages
    Powerful Essays
  • Good Essays

    Jharna Software

    • 896 Words
    • 4 Pages

    Harvard Business Case: "Living on Internet Time: Product Development at Netscape, Yahoo!, NetDyanamics, and Microsoft".…

    • 896 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Net and Java Comparison

    • 490 Words
    • 2 Pages

    The NET and Java have a lot of similarities, but they are also extremely different. To start the NET framework is built directly into the windows OS, which makes it very simple when deploying to a computer, in that it does not require the need to install any third party add-ons unless specifically used. Since the framework is built into the OS, it has built in functionality for using other OS dependent functionality. For example, it can offer access to Windows active directory. Java requires the use of the Java Virtual Machine (JVM) so that it can run the programs.…

    • 490 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Linux Interview Questions

    • 10428 Words
    • 42 Pages

    1. How do you take a single line of input from the user in a shell script?…

    • 10428 Words
    • 42 Pages
    Powerful Essays
  • Good Essays

    References: Mackenzie, D., Sharkey, K. (2001, 20 August). InformIT: Building the user interface with web forms. Retrieved August 7, 2011 from http://www.informit.com/articles/article.aspx?p=131102…

    • 762 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    Java vs .Net

    • 970 Words
    • 4 Pages

    CDCo needs to improve its architecture strategy in order to make the current application architecture more efficient and productive. Looking at the level 0 target state architecture of CDCo, improvement is necessary and choosing which types of technology to use needs to be thoroughly examine to see which is more beneficial to use or adapt. We will address this and explain which approached we will choose after presenting the benefits and pointing out the problems that can eliminate high cost of maintenance. We will define and compare two technologies, discuss their advantages and disadvantages so that we can rule out the best option that we have. Furthermore it is very important to know how this two software architecture overhead cost when it is implemented. For the purpose of this white paper I will introduce the technology that I believe and consider to be appropriate solutions on the current CDCo’s software architecture these are the JAVA technology and the .NET technology.…

    • 970 Words
    • 4 Pages
    Powerful Essays
  • Powerful Essays

    A Look at Microsoft Access

    • 3444 Words
    • 14 Pages

    Team A of DBM/405 has chosen to look at Microsoft Access. This paper will examine Microsoft Access and its capabilities and benefits. It should show that Microsoft Access is one of the easiest user friendly database and cost effective database applications today. This paper will also examine the use of Access for a business called Parrothead Productions. It is a small one-man operation, which is a remote disc jockey business.…

    • 3444 Words
    • 14 Pages
    Powerful Essays
  • Satisfactory Essays

    java

    • 312 Words
    • 2 Pages

    AllocationStrategy.java import java.util. ArrayList; import java.util. Collection; import java.util. Iterator; import java.util. List; import java.util.…

    • 312 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    java

    • 571 Words
    • 3 Pages

    System.out.println("The clerk's number is" + clerk.getEmpNum() + " and the friver's number is " + driver.getEmpNum());…

    • 571 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Java Environments

    • 1345 Words
    • 14 Pages

    CSCI 1101 Computer Science II Assignment No. 2 Date Given: January 31, 2011 Due: February 18, 2011 David Mongrain B00554371 Parking ticket simulator ParkedCar.java //Object representation of a car. public class ParkedCar { private String carMake; private String carColor; private int carLicense; //Constructs the car, with given car make, car color, and car license.…

    • 1345 Words
    • 14 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Java

    • 762 Words
    • 4 Pages

    In the long distant future, in the year 2016, the cable news empire has fallen, and former talking heads have stooped to running for political office. In fact, five former talk show stars are running for President of the United States, and locked in a close race.…

    • 762 Words
    • 4 Pages
    Satisfactory Essays
  • Powerful Essays

    Java

    • 2071 Words
    • 9 Pages

    The Next Gen IT Trends & Web Technologies – Course Plan - Version 1.1 is released for…

    • 2071 Words
    • 9 Pages
    Powerful Essays

Related Topics