2

我想从一个 bat 文件执行一个 Java 类,它包括opencsv.jar. 下面是代码:

@echo off    
set path=%PATH%;C:\Program Files (x86)\Java\jdk1.6.0\bin    
javac -cp opencsv.jar ArbitrageUsingThread.java    
java ArbitrageUsingThread

运行时出现以下错误。我认为包括在内有一些问题opencsv.jar有人可以帮助我吗?

Error
Exception in thread "main" java.lang.NoClassDefFoundError: au/com/bytecode/openc
sv/CSVWriter
        at ArbitrageUsingThread.main(ArbitrageUsingThread.java:67)
Caused by: java.lang.ClassNotFoundException: au.com.bytecode.opencsv.CSVWriter
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more
4

1 回答 1

2

java is similar to javac for classpath.

Under linux:

java -cp opencsv.jar:. ArbitrageUsingThread

Under windows:

java -cp opencsv.jar;. ArbitrageUsingThread
于 2013-08-21T17:08:33.047 回答