发新话题
移动帖子 加入精华 加入置顶 加入收藏 关注此帖

java 调用dll文件问题!!!!



java 调用dll文件问题!!!!

根目录下有一个javaDC.dll文件

以下的类是通过javaDC.dll加密和解密``
package test;

import org.xiaomaha.tools.Pack;
import org.xiaomaha.tools.User;


public class dll {

	public native static String coding(String sin); //加密
	public native static String decoder(String sin); //解密

	static { 
	System.loadLibrary("javaDC"); 
	}
	public static String getdecoder(String in){
		return decoder(in);
	}

}


main 调用一点问题都没``````为什么```````webservices接口实现类用就要出``InvocationTargetException
错误!????希望高手解答下!?
package com.xiaomaha.services;

import test.dll;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String str="eJzLS8xNta3ITMzPTcxI1ClILC4uzy9KsTU0NjQCAJKBCco=";
		
		System.out.println(dll.getdecoder(str);
	}

}


接口实现类
package com.xiaomaha.services;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.xiaomaha.tools.Pack;

import test.dll;
//Generated by MyEclipse

import com.xiaomaha.dao.IUserDAO;
import com.xiaomaha.dao.UserDAO;
import com.xiaomaha.po.User;

public class testImpl implements Itest {
	private UserDAO dao;
	
	public UserDAO getDao() {
		return dao;
	}

	public void setDao(UserDAO dao) {
		this.dao = dao;
	}

	public String example(String message) {
		String str="eJzLS8xNta3ITMzPTcxI1ClILC4uzy9KsTU0NjQCAJKBCco=";
		System.out.println(dll.getdecoder(str));
//		try {
//			User user = (User)Pack.createObject(User.class,message);
//			dao.insertUser(user);
//		} catch (Exception e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
		return message;
	}
	
}
编辑 回复 快速回复 TOP

Re:java 调用dll文件问题!!!!

会不会是这个Dll的问题啊.放到Tomcat 下边试试
编辑 回复 快速回复 TOP

Re:java 调用dll文件问题!!!!

问题以解决`
配置一个环境变量```将dll丢进去就可以了``任何地方都行`
编辑 回复 快速回复 TOP

Re:java 调用dll文件问题!!!!

呵呵,果然是位置的问题。
快乐渡过每一天,减肥坚持每一天
编辑 回复 快速回复 TOP
发新话题