This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is JNI crossplatform ?  RSS feed

 
Shuang mu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, expert

Is the JNI cross platform ? As we know, java is crossplatform, so what if we use up JNI and build app with some dll(win32) .

Then can the app run at Linux with that dll? Or we need to recompile the native code again in Linux?

Is there anyway to embed C/C++ code inside java and make it work like pure java ? mean it can be crossplatform.

Thanks for reply.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The deal with JNI and native code is that it calls code which is "native" to a particular platform. So it doesn't matter that Java itself is cross platform, it doesn't build the functionality of the particular piece of native code into the java byte code, it just supplies a bridge. So its still the dll which will do the work - and so you'd need a platform which can run that particular dll to run that java code.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!