C
chriskr7
HI, There.
I am having problem with executing java class file. Every path setting
are in right
position. When I compile like a simple hello program it works right and
it executes.
However, when I compile below source file, It compiles.. but when I try
to
execute it, there is an error coming out like this
"Exception in thread "main" java.lang.NoClassDefFoundError: INativeQR
<wrong
name: kr/co/sunwooinfo/INativeQR".
My OS is XP sp2 and sdk is jdk1.5.0_07. and the dll file is compiled
with g++
and the native function in c++ is
Java_kr_co_sunwooinfo_INativeQR_MakeQR().
I tested everything in windows enviroment including the dll file, and
It works right.
but having trouble with jdk. is there any expert who can give me some
advices?
===============================================================
/**
------------------------------------------------------------------------
**\
** File Name:
**
** INativeQR.java
**
** Distribute:
**
** Define INativeQR Class for Calling Navive Function(MakeQR)
**
\**
------------------------------------------------------------------------
**/
package kr.co.sunwooinfo;
import java.lang.*;
import java.io.*;
import java.util.*;
public class INativeQR
{
//
--------------------------------------------------------------------------
// --------- Native Function
----------
//
--------------------------------------------------------------------------
public native int MakeQR(byte[] pSavePath, byte[] pFileName, byte[]
pSource,
int pDevide, int pErrorDegree, int
pEncodeOpt, int pStretch);
static {
System.loadLibrary("INativeQR");
}
//
--------------------------------------------------------------------------
// --------- Member Values
----------
//
--------------------------------------------------------------------------
private static final String SEPARATOR = "/";
private String g_sSavePath;
private String g_sFileName;
private String g_sSourceData;
private int g_iDivideNumber;
private int g_iErrorDegree;
private int g_iEncOpt;
private int g_iStretch;
private boolean g_bResult;
private Vector g_vResultMessage;
//
--------------------------------------------------------------------------
// --------- Member Functions
----------
//
--------------------------------------------------------------------------
/**
----------------------------------------------------------------------
**\
** @ Function Name
**
** : INativeQR
**
**
**
** @ Distribute
**
** : Constructor
**
** Init Member Value
**
\**
----------------------------------------------------------------------
**/
public INativeQR()
{
g_sSavePath = "c:\\work";
g_sFileName = "test";
g_sSourceData = "chris han is testing now...";
g_iDivideNumber = 1;
g_iErrorDegree = 2;
g_iEncOpt = 0;
g_iStretch = 1;
g_bResult = true;
}
public boolean makeQR()
{
int iResult = 0;
/*for-windows*/
byte[] aSavePath = g_sSavePath.getBytes();
byte[] aFileName = g_sFileName.getBytes();
byte[] aSource = g_sSourceData.getBytes();
System.out.println("MakeQR calling...");
iResult = MakeQR(aSavePath, aFileName, aSource, g_iDivideNumber,
g_iErrorDegree, g_iEncOpt, g_iStretch);
if(iResult != 0)
g_bResult = true;
else
g_bResult = false;
return g_bResult;
}
public static void main(String args[]){
INativeQR QRBuilder = new INativeQR();
QRBuilder.makeQR();
if(QRBuilder.g_bResult)
System.out.println("Success");
else
System.out.println("Fail");
}
}
I am having problem with executing java class file. Every path setting
are in right
position. When I compile like a simple hello program it works right and
it executes.
However, when I compile below source file, It compiles.. but when I try
to
execute it, there is an error coming out like this
"Exception in thread "main" java.lang.NoClassDefFoundError: INativeQR
<wrong
name: kr/co/sunwooinfo/INativeQR".
My OS is XP sp2 and sdk is jdk1.5.0_07. and the dll file is compiled
with g++
and the native function in c++ is
Java_kr_co_sunwooinfo_INativeQR_MakeQR().
I tested everything in windows enviroment including the dll file, and
It works right.
but having trouble with jdk. is there any expert who can give me some
advices?
===============================================================
/**
------------------------------------------------------------------------
**\
** File Name:
**
** INativeQR.java
**
** Distribute:
**
** Define INativeQR Class for Calling Navive Function(MakeQR)
**
\**
------------------------------------------------------------------------
**/
package kr.co.sunwooinfo;
import java.lang.*;
import java.io.*;
import java.util.*;
public class INativeQR
{
//
--------------------------------------------------------------------------
// --------- Native Function
----------
//
--------------------------------------------------------------------------
public native int MakeQR(byte[] pSavePath, byte[] pFileName, byte[]
pSource,
int pDevide, int pErrorDegree, int
pEncodeOpt, int pStretch);
static {
System.loadLibrary("INativeQR");
}
//
--------------------------------------------------------------------------
// --------- Member Values
----------
//
--------------------------------------------------------------------------
private static final String SEPARATOR = "/";
private String g_sSavePath;
private String g_sFileName;
private String g_sSourceData;
private int g_iDivideNumber;
private int g_iErrorDegree;
private int g_iEncOpt;
private int g_iStretch;
private boolean g_bResult;
private Vector g_vResultMessage;
//
--------------------------------------------------------------------------
// --------- Member Functions
----------
//
--------------------------------------------------------------------------
/**
----------------------------------------------------------------------
**\
** @ Function Name
**
** : INativeQR
**
**
**
** @ Distribute
**
** : Constructor
**
** Init Member Value
**
\**
----------------------------------------------------------------------
**/
public INativeQR()
{
g_sSavePath = "c:\\work";
g_sFileName = "test";
g_sSourceData = "chris han is testing now...";
g_iDivideNumber = 1;
g_iErrorDegree = 2;
g_iEncOpt = 0;
g_iStretch = 1;
g_bResult = true;
}
public boolean makeQR()
{
int iResult = 0;
/*for-windows*/
byte[] aSavePath = g_sSavePath.getBytes();
byte[] aFileName = g_sFileName.getBytes();
byte[] aSource = g_sSourceData.getBytes();
System.out.println("MakeQR calling...");
iResult = MakeQR(aSavePath, aFileName, aSource, g_iDivideNumber,
g_iErrorDegree, g_iEncOpt, g_iStretch);
if(iResult != 0)
g_bResult = true;
else
g_bResult = false;
return g_bResult;
}
public static void main(String args[]){
INativeQR QRBuilder = new INativeQR();
QRBuilder.makeQR();
if(QRBuilder.g_bResult)
System.out.println("Success");
else
System.out.println("Fail");
}
}