JNI Native « Graphics Desktop « Java Articles

Home
Java Articles
1.Build Deploy
2.Class
3.Core Library
4.Data Types
5.Database JDBC
6.Design
7.Development
8.File Input Output
9.Graphics Desktop
10.J2EE Enterprise
11.J2ME Wireless
12.JVM
13.Language
14.Library Product
15.Network
16.Security
17.SOA Web Services
18.Test
19.Web Development
20.XML
Java Articles » Graphics Desktop » JNI Native 

1. Integrate Java and C++ with Jace    javaworld.com

Jace is a free, open source toolkit designed to make JNI programming easy. It supports automatic generation of C++ proxy classes from Java classfiles and C++ integration of Java exceptions, arrays, packages, and objects. It manages the lifetimes and thread bindings of Java references transparently. Most importantly, it reduces development costs by allowing you to write code modules that are smaller, easier to understand, and compile-time type safe.

2. C#, the natural progression    javaworld.com

July 31, 2000 -- Microsoft's new vision of the Internet is a far cry from today's network of online content. Microsoft views the future Internet as a world of interrelated services that are developed by different individuals, written in different languages, deployed on different types of hardware, and hosted by different Internet operating systems.

3. C#: A language alternative or just J--?, Part 2    javaworld.com

Fortunately, C# has several features that go beyond the cosmetic. Some of these, such as enumerated values ("enums"), are simple "syntactic sugar," providing self-documentation and arguably clearer source code. Other features, such as delegates and events, are quite useful (though implemented in a confusing way) and provide functionality built into the language that, in Java, requires coding and a nontrivial understanding of Java design patterns.

4. Use native methods to expand the Java environment    javaworld.com

Unfortunately, using native methods may not be the best solution. When you use native methods in computation-intensive tasks like tight loops, which occur when you repeatedly call a function, you may find that the process of setting up parameters, calling the method, and getting the return values for each iteration of the loop takes longer than the time it takes to execute the function.

5. Alberto Savoia talks shop about C.R.A.P.    javaworld.com

According to Alberto Savoia, 80 percent of developers spend most of their career working on other people's code -- and a depressing percentage of that code is crappy! In this engaging interview with code quality evangelist Andrew Glover, Savoia reveals the thinking behind the C.R.A.P. metric, and explains how you can use it, in tandem with the new Crap4j plugin for Eclipse, to evaluate inherited code. Andrew also gets Alberto talking about some of the recent critique of the C.R.A.P. metric, and how he and co-creator Bob Evans would like to see the metric evolve.

6. Embed Java code into your native apps    javaworld.com

Consider a simple C program with a Motif user interface. By browsing through its menus, currently the user can create OpenGL windows that contain some simple 3D rendering. You have been asked to add a new menu to this application; you want to implement it using the Swing package from the JDK. The Java Native Interface (JNI) API from the Java Runtime Environment provides you with the tools you need to start a JVM from a C program and accomplish the task at hand. Using that JVM, JNI also allows you to create Java objects and call the objects' methods. Assuming that you have written the code needed for a Java class that implements the required menu (see SwingMenu.java for the full Java code, available for download from Resources), you now have to access the JNI from the C code to start the JVM and load your class. Listing 1 illustrates those last two tasks:

7. C#: A language alternative or just J--?, Part 1    javaworld.com

In this article, I will examine common motivations for creating a new computer language, and speculate on which might have led to C#. Next I will introduce C# with regard to its similarities to Java. Then I will discuss a couple of high-level, fundamental differences in scope between Java and C#. I close the article by evaluating the wisdom (or lack thereof) in developing large applications in multiple languages, a key strategy for .Net and C#.

8. A Java Programmer Looks at C# Delegates    onjava.com

While C# has a set of capabilities similar to Java, it has added several new and interesting features. Delegation is the ability to treat a method as a first-class object. A C# delegate is used where Java developers would use an interface with a single method. In this article, the use of delegates in C# is discussed, and code is presented for a Java Delegate object that can perform a similar function. Download the source code here.

9. Cooking with C#, Part 2    onjava.com

Editor's note: Stephen Teilhet and Jay Hilyard, authors of the recently released C# Cookbook, hand-selected these recipes to excerpt on ONDotNet to give you a real glimpse at the kinds of solutions you'll find in the book. Like all the recipes in this latest release in O'Reilly's cookbook series, the solutions here get straight to the heart of the problem, like how to use the GetHTMLFromURL method to grab the HTML you want from a URL. And in case you missed them, check out the first batch of recipes the authors chose for publishing here.

10. C# in a Nutshell: Introducing C# and the .NET Framework, Part 2    onjava.com

C# in a Nutshell: Introducing C# and the .NET Framework, Part 1 What makes C# different? Besides being a full-fledged object-oriented language, C# was designed from the ground up for component-based programming, a unified type system, type safety, and most of all a pragmatic world view. Get a full introduction to C# is a three-part installment of O'Reilly's C# in a Nutshell.

11. Cooking with C#    onjava.com

Editor's note: Converting strings and handling exceptions, two of the topics covered in depth in today's recipes, are just a few of the hundreds of solutions to specific problems included in C# Cookbook. Whether you're new to the C# language or an experienced C# programmer, C# Cookbook provides practical answers to the day-to-day questions you run up against.

12. Getting Started with C#, Part 2    onjava.com

Getting Started with C#, Part 1 Find out how to write your first C# program in this book excerpt from Learning C#. This is the first of two excerpts on getting started with C#.

13. C# in a Nutshell: Introducing C# and the .NET Framework, Part 3    onjava.com

C# in a Nutshell: Introducing C# and the .NET Framework, Part 2 In the second part of our excerpt from O'Reilly's C# in a Nutshell, the authors introduce the Common Language Runtime and the Framework Class Library.

14. C# Generics: Collection Interfaces    onjava.com

The .NET Framework provides two sets of standard interfaces for enumerating and comparing collections: the traditional (nontype-safe) and the new generic type-safe collections. This book focuses only on the new, type-safe collection interfaces as these are far preferable.

15. Programming C#: Attributes and Reflection    onjava.com

Attributes are a mechanism for adding metadata, such as compiler instructions and other data about your data, methods, and classes, to the program itself. Attributes are inserted into the metadata and are visible through ILDasm and other metadata-reading tools.

16. Getting Started with C#, Part 1    onjava.com

Getting Started with C#, Part 2 In this final installment from Learning C#, we'll break down your first C# program by examining the details that went into creating it.

17. C# in a Nutshell: Introducing C# and the .NET Framework, Part 1    onjava.com

C# in a Nutshell: Introducing C# and the .NET Framework, Part 2 In the second part of our excerpt from O'Reilly's C# in a Nutshell, the authors introduce the Common Language Runtime and the Framework Class Library.

18. Half Million Lines of C# Running on J2EE    theserverside.com

The biggest user of this technology has ported a half-million line C# multi-tier distributed web application to run on Tomcat and Linux. This company is Infogate Online, a provider of Telco and ISP software for video on demand applications. Write once in Visual Studio and run anywhere? Mainsoft provides a plug-in to Microsoft Visual Studio, which enables programmers using ASP.NET and ADO.NET to deploy on Java Application Servers. Visual Mainwin converts Microsoft Intermediate Language (IL) into Java Bytecode. Visual C# or Visual Basic can indeed be deployed onto Java Application Servers.

19. Make Your Swing App Go Native, Part 3    today.java.net

Make Your Swing App Go Native, Part 2 Swing applications don't often feel or behave like native apps. It doesn't have to be this way. Joshua Marinacci's continues with a look at providing double-clickable executables and filetype associations.

20. Robert C. Martin    today.java.net

Aristotle's Error or Agile Smagile.: The word Agile is getting overloaded. Does it really have a definition anymore? Posted by rmartin on September 02, 2003 at 20:53 PST | Permalink | Discuss (10)

21. Make Your Swing App Go Native, Part 1    today.java.net

Make Your Swing App Go Native, Part 3 Swing applications don't often feel or behave like native apps. It doesn't have to be this way. Joshua Marinacci's three-part series concludes with polishing touches such as desktop icons, file selectors, and splash screens.

22. Make Your Swing App Go Native, Part 2    today.java.net

This text file will create an executable in the dist directory, setting it to be a windowed application (hiding the stdout console window), sets the main class file, and includes all of the relative classes. Note that we have to specify the .jars twice, once to make sure they are included in the final .exe (the /r *.jar part), and then once to make sure they are in the classpath and available to the application (the /jar:joshy-common.jar part). Unfortunately, the names of the .jars and class files have to be hardcoded in this text file. Hopefully DuckWare will make Ant tasks in a future version, or we could use custom tasks to edit the file in place. We won't need to change it very often, so this is okay.

23. Java Mobility Podcast 5: A Talk With Java ME Expert C. Enrique Ortiz    today.java.net

C. Enrique Ortiz, a recognized mobility expert, renowned blogger, developer, and author, touches on a range of mobility topics in this interview, including: moving to CDC; the latest JSRs that are important to mobile developers; mobile AJAX; and the issue of device fragmentation.

24. William C. Wake    today.java.net

Measured Smells In this excerpt from his book Refactoring Workbook, author William C. Wake provides examples of the easy to detect code smells of comments, long method, large class, and long parameter list. Nov. 12, 2003

25. Invoking Assembly Language Programs from Java    today.java.net

JNI is much more than what has been shown here. This article presents one of the ways in which interaction can take place between Java code and assembly language code. But the two issues demonstrated--accessing interface functions and type conversion--not only allow Java programs to call native code but form important building blocks for all the other types of interaction, too.

26. Making Java Technology Faster Than C with LRWP    java.sun.com

The implementation was faster than Xitami/NexSRS -- Xitami is a very small web server written in C, and is one of the top 10 web servers. Our implementation was to scale better on bigger CMT systems, but LRWP in Java was faster by 23% on a single core system and by 78% on a 4 core system, showing scalability from a single core to multiple cores while Xitami's scaled to just about 15K CPM on the 4 core system, Fig 1.

27. SWT Creates Fast, Native-looking GUIs for Your Java Apps    devx.com

In short, SWT widgets (UI components) let you create fast, native-looking GUIs for your Java applications. If platform independence is not a required feature for your application, SWT may be a very attractive option. Though application development with SWT involves some study, it is not a steep learning curve for Java programmers. This tutorial teaches the basic steps to get started with SWT and introduces the SWT widgets and their usages in a simple SWT application.

28. Java programming with JNI    ibm.com

The Java? Native Interface (JNI) is a native programming interface that is part of the Java SDK. JNI lets Java code use code and code libraries written in other languages, such as C and C++, and allows you to call Java code from within native code. In this tutorial, IBM enterprise developer Scott Stricker deals with the two most common applications of JNI: calling C/C++ code from Java programs, and calling Java code from C/C++ programs. We'll cover both the essentials of the Java Native Interface and some of the more advanced programming challenges that can arise.

29. Gems from e-BIT: JNI Get* calls    ibm.com

The Get* calls must guarantee that the pointer returned remains valid until Release* is called, so the JVM will either hold additional copies of the data or "pin" the data, so it can neither be garbage collected nor moved during heap compaction. This will cause subsequent heap problems.

30. Debugging integrated Java and C/C++ code    ibm.com

Any debugging process that uses a Java debugger is, from the operating system's point of view, an application-level operation. However, debugging native applications is considered a more privileged activity and the entire application will be stopped to debug native code, which means that the JVM can't interact with a Java debugger.

31. Handling events from native objects in Java code    ibm.com

In an object-oriented system, an object can fire a set of events. The Java programming language provides support for defining event listeners based on the Observer design pattern, but this isn't sufficient when you need to use objects written in other languages. Using the Java Native Interface (JNI) to communicate between a native event source and Java listeners can be tricky, especially in multithreaded environments. In this article, we describe a design pattern for transparently handling event communication from native code to the JVM. You can use this design to provide a Java interface to a legacy native application or to build native applications with Java listeners in mind.

32. How to integrate Python 2.3 with the Java Native Interface on AIX 5L    ibm.com

AIX 5L distribution media provides a pre-compiled version of Python 2.2 libraries that you can integrate with JNI to allow Java and Python programs to co-exist within the same process, as is. However, when you download Python from its open source Web site and compile using the make procedures provided with the tool, in some situations, integrating Java and Python can result in unpredictable results. The information provided here is specific to Python 2.3.

33. IBM - DB2 Express-C - Software    www-01.ibm.com

DB2 Express-C is ideal for small business, partners, developers, instructors, and students. DB2 Express-C can be used at no charge, and optional low cost support.

34. e-BIT bytes: JNI pitfalls    ibm.com

There have been a number of articles, on the developerWorks Java technology zone and elsewhere, on how to write JNI code. JNI has its place, but there are also reasons not to use it:

35. Download : IBM DB2 Express-C 9    ibm.com

DB2 Express-C is production-ready and free to use for development and deployment. ISVs and business partners may also distribute DB2 Express-C at no charge with their solutions after registering with IBM.

36. Weighing in on Java native compilation    ibm.com

To bring you up to speed on Java native compilation technology, we'll start with a discussion of the basics of code compilation, including a brief overview of why many developers are employing Java native compilers for their applications. Next, we'll test the results of Java native compilation, using a free software compiler and two different applications (one very simple, the other more sophisticated). These examples and the resulting metrics will serve as a first-hand look at how the recent Java native compilers compare with the JVM.

37. NLS strings and JNI    ibm.com

This paper presented examples for implementing native methods dealing with conversion of strings for an NLS-enabled Java program environment. Strings are maintained in Unicode in Java and must be converted appropriately using the following JNI APIs:

38. Java programming for C/C++ developers    ibm.com

This tutorial introduces the Java? programming language to C and C++ developers. Because you already know how to program in C/C++, we'll approach many Java programming concepts by comparison. You will learn a great deal about Java programming by learning how the Java language is similar to, and different from, C and C++. Overall, the purpose of this tutorial is to teach you the fundamentals of the Java language and get you programming quickly.

39. First Impressions of C#: Java Killer or Java Wannabe?    developer.com

Last year, rumors surfaced that Microsoft Corp. was developing a new language to compete head-to-head with Java, dubbed "Cool". It will not come as a surprise to many readers that the relationship between Microsoft and Sun Microsystems is strained, and legal action is still pending ? so a strong competitor to Java would be extremely advantageous for Microsoft. As part of recent announcements about the Microsoft .NET platform, came the debut of C#, a new language derived from C++. Though Microsoft is careful not to mention Java in relation to C#, the gauntlet has been laid down for competition.

40. Simple DirectMedia Layer: Gaming Platform for C++, Java, and More    developer.com

In gaming, more so than any other programming regime, it is important to specify the platform correctly from the start. Will you support Windows, Linux, and OS X? Indeed, many people would cite the revolutionary Quake game written for OpenGL in 1996 as the granddaddy of game platforms. However, to reach Quake-level gameplay standards you will also need world-class audio support, network connectivity, user-input device support, and real-time management capabilities, just to name a few? The solution to both problems, cross-platform support and the extras that make a game exciting, is Simple DirectMedia Layer (SDL). This is a cross-platform multimedia library designed to provide low-level access to audio, keyboard, mouse, joystick, OpenGL, and 2D video framebuffer. SDML supports almost every platform I can think of, including Linux, Windows, all MacOs variants, WinCE, Dreamcast, and others. Because it is distributed on GNU LGPL v2, you can use SDL freely in commercial programs as long as you link with the supplied DLL.

41. Binding Java and Web Services to Native Code    developer.com

The Native Connector Architecture (NCA) is a model that allows for the automatic generation of code bridges between differing languages and platforms. Given a description of the interfaces exposed (and desired), it is then possible to derive and generate the code necessary to bridge the two bodies of code. The architecture defines an extensible and highly configurable model for the description of interfaces as well as the generation of bridging code using open standards for general use. As a result, bridges can easily be created between, for example, the C++ and JavaTM languages, differing C++ Application Binary Interfaces (ABI), Web service protocols (such as SOAP), as well as inter-platform bridges (for example, Microsoft COM/.NET to SolarisTM operating environment binaries).

42. Understanding Properties in Java and C#    developer.com

Properties are so similar between C# and Java that if you understand properties in either language, you should have no difficulty understanding properties in both languages.

43. Converting Java to C#    developer.com

The Java Language Conversion Assistant (JLCA) is a tool that provides the ability to convert Java code and library calls to Microsoft Visual C# .NET. Built based on the ArtinSoft migration technology, this second version adds a number of additional features to its abilities. This includes the ability to convert code from both the client and the server. Developers will be able to convert Web as well as Windows®-based applications. Java Server Pages and Java servlets can also be converted to ASP.NET.

44. Views from Abroad: GoXML DB, a Native XML Database for Java    developer.com

GoXML is the first commercial product featured in "Views from Abroad." As XML's popularity keeps soaring, it seemed a good time to learn about the database technology being built by the Canadian company.

45. First Impressions of C#: A Language Overview    developer.com

C#, part of the new Microsoft .NET platform, bears all the hallmarks of a great language. Strikingly similar to Java, the language includes some of the best attributes of modern object-oriented languages, as well as adding a few new tricks of its own. In this second part of our series (see First Impressions of C#: Java Killer or Java Wannabe? ,) I'll cover some of the important new features of C#, along with offering a balanced view of its drawbacks.

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.