classic Hello World in JavaScript (in C++)int main(int argc, char* argv[]) { // Create a string holding the JavaScript source code. String source = String::New("'Hello' + ', World'") ; // Compile it. Script script = Script::Compile(source) ;
// Run it. Value result = script->Run() ; // Convert the result to an ASCII string and display it. String::AsciiValue ascii(result) ; printf("%s\n", *ascii) ; return 0; }
不好意思哈 我也是做java的 c++那边的代码我没有
String source = String::New("'Hello' + ', World'") ; // Compile it.
Script script = Script::Compile(source) ;
// Run it.
Value result = script->Run() ; // Convert the result to an ASCII string and display it.
String::AsciiValue ascii(result) ;
printf("%s\n", *ascii) ;
return 0;
}
回复:AARON7744 因为这们这是在第三方插件,而插件接口是c++开发的,而我们用的是java技术,所以,要实现java与c++的通信,并且是跨服务器的。
你的那段代码是不能跨服务器的对吗?只能本地调用,而我需要跨服务器调用才行!
你可以考虑使用 Awesomium API也许学一下
http://support.awesomium.com/kb/javascript/introduction-to-javascript-c-integration
会对你有帮助。
http://blog.csdn.net/xiage/article/details/4528877