问题描述:
该函数在win平台上面调用不是很成功,gui会可以调出来,但可能和屏蔽调其中的一些用到cui的功能,而调用cui如masm.exe是很不成功,出现一个黑屏,没用内容,或者根本不有结果。
其程序如下:
| class runthread{ process t public void run(){ try{ t = java.lang.runtime.getruntime().exec("c:\\masm.exe"); }catch(java.io.ioexception e ) { system.out.println(e); } } } /******************/ class runexenative{ public static void main(string args[]){ runthread rt = new runthread(); rt.run(); } } |
下面是jni + c 的本地化的实现方法:
写一个:callexenative.h
步骤如下:
| step one : /**** callexenative.java ****/ 编写callexenative.java文件 import java.lang.*; class callexenative{ public native static void cen(); static { system.loadlibrary("callexenative"); } } |
| javac callexenative.java javah callexenative |
| /* do not edit this file - it is machine generated */ #include <jni.h> /* header for class callexenative */ #ifndef _included_callexenative |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器