我们如何在Java代码中使用.cpp文件 [英] How can we use .cpp files in java code

查看:526
本文介绍了我们如何在Java代码中使用.cpp文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生,

我有收集c ++文件.我想在Java代码中调用/使用它们.
我们该怎么办?
请提出一个建议.

问候
sankar

Dear Sir,

I have collection c++ files. I want to call/use them in java code.
How can we do it?
Please give a suggestion to do it.

regards
sankar

推荐答案

我已经回答了这个问题
I already answered this question here[^]. For future reference, please post your question in one forum only.


您应该阅读有关
You should read about the Java Native Interface, JNI[^].



C ++和Java具有非常不同的基础概念,因此不可能直接实现.
您可以尝试将C ++代码翻译为Java,有时这几乎是不可能的.如果使用Google翻译,您会发现一些免费或付费的翻译程序.
我的个人经验是,它们几乎没有用.
对于手写翻译,请查看
快速转换并参考最常见的内容
C/C ++和Java中使用的常见命令
[^ ] .

最终,最快,最好的方法是使用C ++代码库作为参考从头开始用Java编写.
欢呼声,
AR
Hi,
C++ and Java have so different underlying concepts that it''s not possible directly.
You may try to translate the C++ code to Java, which is sometimes near to impossible. You will find some free or paid translator programs if googling for them.
My personal experience is that they are almost useless.
For handwritten translation have a look at Quick conversion and reference to the most
common commands used in C/C++ and Java
[^].

Eventually the quickest and best way is to write in Java from scratch, using the C++ code base as reference.
cheers,
AR


这篇关于我们如何在Java代码中使用.cpp文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆