Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling c/c++ derived object files

 
Vasant Manohar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i wanted to know if java allows you to compile object files derived from c/c++. if yes, please let me know how to do so.

thanks in advance.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Welcome to JavaRanch!

Of course, no compiler allows you to compile object files; object files represent code that's already been compiled. If you're asking whether you can link native object files directly with Java, the answer is no; Java's bytecode is utterly different from native machine code.

If you're asking whether, one way or another, you can call C/C++ functions from Java, on the other hand, the answer is yes, you can -- you can use the Java Native Interface, or JNI.
 
Vasant Manohar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,

yes, i was asking about linking native object files with java. since its not possible, i shud probably look at JNI as you suggested.

thanks for the prompt reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic