Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
A simple example for calling an existing java code from c using jni?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="missshirin" data-source="post: 1125746" data-attributes="member: 175640"><p>I have an existing java code and I want to use its function in c language. As I found till now I should use jni. I have read a sample in this link:</p><p><a href="http://www.ibm.com/developerworks/java/tutorials/j-jni/section3.html" target="_blank">Java programming with JNI</a></p><p>If I want to compile the c code with the command below I have to change the code a little.Because of the last sentence that has mentioned in this link:</p><p><a href="http://lists.apple.com/archives/Java-dev/2006/Feb/msg00446.html" target="_blank">Re: JNI NIO early compilation error</a></p><p></p><p>I use these command to compile: </p><p>g++ -framework -I/System/Library/Frameworks/JavaVm.fram… -c Sample2.c -o Sample2.o</p><p>I got this as result :</p><p>i686-apple-darwin10-g++-4.2.1: cannot specify -o with -c or -S with multiple files</p><p></p><p>and it doesn't work! and I don't know how should I compile and run it.:-(</p><p>and I even know what's wrong with that!</p><p>Can you please put any comment on this ? Or do you know another way to do what I'm going to do.</p><p>thanks.<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /></p></blockquote><p></p>
[QUOTE="missshirin, post: 1125746, member: 175640"] I have an existing java code and I want to use its function in c language. As I found till now I should use jni. I have read a sample in this link: [url=http://www.ibm.com/developerworks/java/tutorials/j-jni/section3.html]Java programming with JNI[/url] If I want to compile the c code with the command below I have to change the code a little.Because of the last sentence that has mentioned in this link: [url=http://lists.apple.com/archives/Java-dev/2006/Feb/msg00446.html]Re: JNI NIO early compilation error[/url] I use these command to compile: g++ -framework -I/System/Library/Frameworks/JavaVm.fram… -c Sample2.c -o Sample2.o I got this as result : i686-apple-darwin10-g++-4.2.1: cannot specify -o with -c or -S with multiple files and it doesn't work! and I don't know how should I compile and run it.:-( and I even know what's wrong with that! Can you please put any comment on this ? Or do you know another way to do what I'm going to do. thanks.:) [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
A simple example for calling an existing java code from c using jni?
Top