Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

linking c/c++ object files

  Asked By: Sienna    Date: Feb 17    Category: Java    Views: 1218
  

I wanted to know whether you can link native object files directly
with Java? If so, please let me know how to do so?

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Aaron Evans     Answered On: Feb 17

no, you can't link object  files with java  classes. The reason is
simply that object files  are _meant_ for being linked whereas Java
classes are meant to be interpreted by the Java interpreter; a .class
file doesn't contain any machine code.

What you could try is one of the following:

1) from C/C++ you only can invoke a Java class using the system()
call or one of the exec() functions; there you would have to execute
something like
sprintf( Cmd_String, "java %s", Path_To_Java_Class);
system( Cmd_String);

2) From Java you could take a look at the System or Runtime classes,
in particular at the loadLibrary() function and relatives. I haven't
understood what they are meant for when browsing through the Javadoc,
but I hope you can make use of this info.

 
Didn't find what you were looking for? Find more on linking c/c++ object files Or get search suggestion and latest updates.




Tagged: