JNI and portability in java

Posted on 2006-11-22
Last Modified: 2013-11-22
I ve got a general question:
If I write a piece of functionality in c++ and make it provided to my java classes via JNI, what is the impact of this crossing on the portability of my java apllication , will it work on linux supposed that the c++ dlls compiled on windows xp or vice versa or not? how to solve this kind of non-portability due to JNI in case there is any?

Question by:TheSilverBullet
LVL 23

Accepted Solution

Ajay-Singh earned 125 total points
ID: 17994631
> will it work on linux supposed that the c++ dlls compiled on windows
> xp or vice versa or not?

may not work. so and dll are different. You need to recompile it on windows, linux

> how to solve this kind of non-portability due to JNI in case there is any?
a. Use pure java
b. Use #ifdef WIN32...
   for different platforms
LVL 86

Expert Comment

ID: 17994633
Portability is limited. You can try recompiling under each platform - depends on what you're doing
LVL 92

Expert Comment

ID: 17994676
depends on the portability of your C+ code. You solve it by making your native code portable.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 17995531
Hi All,
Thanks for your invaluable contributions. actually I need to get the creation date of a list of files, java supports only getting file modification date, which does not suffice in my case, since my main application is written in java I would need a way to walk around this, is there alternative to c++ that migh work on other operating systems, at least the linux flavours ?

do I need to ask this in another thread or does suffice only to increase the points here?
LVL 86

Expert Comment

ID: 17995554
Well different OSs treat file times in different ways too, so there again you would need to be in one #ifdef or other
LVL 92

Expert Comment

ID: 17999130
you're best asking in a different TA, as its not really a Java question.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question