我所用的BC是borland网站免费下载的命令行编译器。以下是各文件清单,最后在生成DLL时出现的错误是
“ Unable to execute command 'ilink32.exe'”
/* firstJNI.java */
class firstJNI
{
public native void displayHelloWorld();
public native void displayOther();
private native String getLine(String prompt); static {
System.loadLibrary("firstJNI");//This is firstJNI.DLL
/*if generated by borland
System.loadLibrary("firstjni");//This is firstjni.dll
*/
}
public static void main(String[] args)
{
firstJNI JN=new firstJNI();
JN.displayHelloWorld();
JN.displayOther();
String input = JN.getLine("Enter Some Thing ");
System.out.println("You Entered " + input); }
}
/* end of firstJNI.java */
/* firstJNI.h *//* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class firstJNI */#ifndef _Included_firstJNI
#define _Included_firstJNI
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: firstJNI
* Method: displayHelloWorld
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_firstJNI_displayHelloWorld
(JNIEnv *, jobject);/*
* Class: firstJNI
* Method: displayOther
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_firstJNI_displayOther
(JNIEnv *, jobject);/*
* Class: firstJNI
* Method: getLine
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_firstJNI_getLine
(JNIEnv *, jobject, jstring);#ifdef __cplusplus
}
#endif
#endif
/* end of firstJNI.h */
/* firstJNI.c */#include <jni.h>
#include "firstJNI.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_firstJNI_displayHelloWorld(JNIEnv *env, jobject obj)
{
printf("Hello world! This DLL was generated using Borland Compiler \n");
return;
}
JNIEXPORT void JNICALL
Java_firstJNI_displayOther(JNIEnv *env, jobject obj)
{printf("Hello world! This is Other Function. This DLL was generated using Borland Compiler \n");
}
JNIEXPORT jstring JNICALL
Java_firstJNI_getLine(JNIEnv *env, jobject obj, jstring enter)
{
char buf[128];
const char *str = (*env)->GetStringUTFChars(env, enter, 0);
printf("%s", str);
(*env)->ReleaseStringUTFChars(env, enter, str); scanf("%s", buf);
return (*env)->NewStringUTF(env, buf);}
/* end of firstJNI.c *//* bcc32.cfg */
-Ic:\borland\bcc55\include;f:\jdk1.1.8\include;f:\jdk1.1.8\include\win32
-Lc:\borland\bcc55\lib;c:\borland\bcc55\lib\psdk
/* end of bcc32.cfg */
“ Unable to execute command 'ilink32.exe'”
/* firstJNI.java */
class firstJNI
{
public native void displayHelloWorld();
public native void displayOther();
private native String getLine(String prompt); static {
System.loadLibrary("firstJNI");//This is firstJNI.DLL
/*if generated by borland
System.loadLibrary("firstjni");//This is firstjni.dll
*/
}
public static void main(String[] args)
{
firstJNI JN=new firstJNI();
JN.displayHelloWorld();
JN.displayOther();
String input = JN.getLine("Enter Some Thing ");
System.out.println("You Entered " + input); }
}
/* end of firstJNI.java */
/* firstJNI.h *//* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class firstJNI */#ifndef _Included_firstJNI
#define _Included_firstJNI
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: firstJNI
* Method: displayHelloWorld
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_firstJNI_displayHelloWorld
(JNIEnv *, jobject);/*
* Class: firstJNI
* Method: displayOther
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_firstJNI_displayOther
(JNIEnv *, jobject);/*
* Class: firstJNI
* Method: getLine
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_firstJNI_getLine
(JNIEnv *, jobject, jstring);#ifdef __cplusplus
}
#endif
#endif
/* end of firstJNI.h */
/* firstJNI.c */#include <jni.h>
#include "firstJNI.h"
#include <stdio.h>
JNIEXPORT void JNICALL
Java_firstJNI_displayHelloWorld(JNIEnv *env, jobject obj)
{
printf("Hello world! This DLL was generated using Borland Compiler \n");
return;
}
JNIEXPORT void JNICALL
Java_firstJNI_displayOther(JNIEnv *env, jobject obj)
{printf("Hello world! This is Other Function. This DLL was generated using Borland Compiler \n");
}
JNIEXPORT jstring JNICALL
Java_firstJNI_getLine(JNIEnv *env, jobject obj, jstring enter)
{
char buf[128];
const char *str = (*env)->GetStringUTFChars(env, enter, 0);
printf("%s", str);
(*env)->ReleaseStringUTFChars(env, enter, str); scanf("%s", buf);
return (*env)->NewStringUTF(env, buf);}
/* end of firstJNI.c *//* bcc32.cfg */
-Ic:\borland\bcc55\include;f:\jdk1.1.8\include;f:\jdk1.1.8\include\win32
-Lc:\borland\bcc55\lib;c:\borland\bcc55\lib\psdk
/* end of bcc32.cfg */
解决方案 »
- Java中的while和for
- 初学BlockingQueue,大牛或者哪位英文好些,请进。。
- 如果方法有返回值,可不可以直接使用
- 关于Excel,java,utf-8,jxl字符集与输入输出的问题
- 就内网一对一语音聊天问题
- 关于jdk1.4的问题
- 如何获得对方的软件版本?
- java 如何编译为一个可用其他语言(JAVA VB VC CB)调用的组件
- 初学java,想求一份详细的编码规范!!谢谢
- 各位大虾,请问哪里有JDK API的chm格式的help下载,感激不禁!
- 请问java有像msdn那样的帮助吗?
- gui程序中打开一个操作繁忙的线程后,frame上的按钮就操作不了了,这是怎么回事?要如何解决?
jdk1.1.8根本没有lib\jvm.lib