Copyright notice: This article from Administration Blog, reproduced please indicate the source: http://blog.csdn.net/a_zhon/.
Directory (?) [+]
One: What is JNI?
JNI:JNI is the abbreviation for Java Native Interface , which provides a number of APIs that enable the communication of Java and other languages (mainly c&c++), in simple terms Java tuning c,c java.
Second: start to build our development environment, is also very simple
dev-c++ tool download, install the default to finish on the OK.
工欲善其事, its prerequisite.
Adjust font Size: Under the menu bar tools–>editor options The font and color in this can change the fonts and colors.
Shortcut keys to view and modify: Under the menu bar Tools–>configure shortcuts ... You'll be able to see all the shortcut keys.
Modify Tool Language: Tools–>environment Options on the right, you can see a language.
Three: Now we can start writing my first C program.
//相当于java的import stdio: standard input$output标准输入输出//.h头文件格式,包含一些函数#include<stdio.h>//导入标准的C语言函数库#include<stdlib.h>int main() { //输出函数 printf("Hello World! \n"); //使docs窗口停留 system("pause"); return 0;}//这里int 和return 0;可以省略不写
Four: The above code in the execution of a computer will play a docs window to you, you can see a HelloWorld.
Five: Since he opened the Docs command line, let's play a few fun
#include<stdio.h>#include<stdlib.h>main() { //打开计算器,相当于在运行输入框输入calc system("calc"); //使docs窗口停留 system("pause");}
As soon as the program runs, you'll find that it's amazing that he helped you open the calculator, and you can also open Notepad, artboards, and so on.
Here our HelloWorld program is done, and next we will continue to learn to hurt each other like friends.
Android JNI Programming (i)--jni concept and C language dev-c++ development environment building, writing HelloWorld