日期:2014-05-20  浏览次数:20851 次

急死了!!关于jacob配置的问题,各位大侠帮帮忙啊~~
我最近在研究jacob   用JAVA生成Excel表格和word。
结果就报错:
Exception   in   thread   "main "   java.lang.UnsatisfiedLinkError:   C:\Java\jdk1.6.0\bin\jacob.dll:   Can 't   find   dependent   libraries
at   java.lang.ClassLoader$NativeLibrary.load(Native   Method)
at   java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at   java.lang.ClassLoader.loadLibrary(ClassLoader.java:1676)
at   java.lang.Runtime.loadLibrary0(Runtime.java:823)
at   java.lang.System.loadLibrary(System.java:1030)
at   com.jacob.com.LibraryLoader.loadJacobLibrary(LibraryLoader.java:57)
at   com.jacob.com.JacobObject. <clinit> (JacobObject.java:150)
at   com.sinosoft.module.lcc.WordBean.openWord(WordBean.java:22)
at   com.sinosoft.module.lcc.WordTest.main(WordTest.java:14)


请问这是怎么回事啊??
在线等待,跪谢各位!!

------解决方案--------------------
你的jacob.jar不在classpath里面,放到项目的web-info/lib下面去
------解决方案--------------------
没遇到过,帮你顶
------解决方案--------------------
肯定是类路径的问题,错误就是找不到类com.jacob.com.Variant
而且,tomcat5.5和jdk6配套吗?记得应该配jdk5吧,不知道有没有关系
------解决方案--------------------
我的是jdk1.5用的是jacob1.11就可以的
package com.meritit.gsedu.lore.support;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.ComThread;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import com.meritit.gsedu.other.MyDBConnect;

public class WordUtils {
private String filePath;

private Connection con;

/**
* @author yuanyj since 2007-6-5 将数据库的word放到文件夹中
* @param table
* @param filebolb
* @param id
*/
public void db2Word(String table, String filebolb, String id) {
String sql = "select files.id,files. " + filebolb
+ " as content_v from " + table + " files where files.id= ' "
+ id + " ' ";
try {
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
System.out.println( "sql= " + sql);
while (rs.next()) {
oracle.sql.BLOB blob = (oracle.sql.BLOB) rs
.getBlob( "content_v ");
File wordFile = new File(filePath+ "\\ " + rs.getString( "id ") + ".doc ");
OutputStream os = new FileOutputStream(wordFile);
InputStream is = blob.getBinaryStream();
int i = 0;
byte[] buffer = new byte[4 * 1024];
while ((i = is.read(buffer)) != -1) {
os.write(buffer, 0, i);
}
is.close();
os.close();
}
rs.close();
stmt.close();

} catch (Exception e) {
System.err.println( "SQL出错 ");
System.err.println(sql);
e.printStackTrace();
}
}

/**
* @author yuanyj since 2007-6-5 将文件夹的word文件转化成html文件
* @param filename
* @param savefilename
* @param id
*/
public void word2Html(String id) {
ActiveXComponent app = new ActiveXComponent( "Word.Application ");
try {
app.setProperty( "Visible ", new Variant(false));