我想从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
答案 0 :(得分:2)
java
类似于javac
。
在linux下:
java -cp opencsv.jar:. ArbitrageUsingThread
在Windows下:
java -cp opencsv.jar;. ArbitrageUsingThread