开发者

java -cp on Windows problem

Can someone please tell me why this java command in a .bat file won't run my java program on WinXP? I have all my jar files in a folder called lib and my class files in a package folder mypackage.

java -cp ".;.\lib\poi-3.7-20101029.jar;.\lib\jsr173_1.0_api.jar;..." mypackage.MyClassWithMain

I have tried all sorts of things to no avail. I get a ClassNotFound error as soon as the program attempts to use some of the classes in the jar files. So, I think there's something wrong with my -cp option. It does find my main().

I want to give this program to someone who doesn't know a thing about computers, so I want them to be able to double-click the .bat file and go.

I wrote everything on a mac without much problem.

I bet the moderator is going to slap me upside the head for this question, but I did search extensively for an answer to开发者_C百科 this.

Thanks you! John

Sorry, I should have put in the entire command line:

java -cp ".;.\libs\jsr173_1.0_api.jar;.\libs\poi-3.7-20101029.jar;.\libs\poi-ooxml-3.7-20101029.jar;.\libs\poi-ooxml-schemas-3.7-20101029.jar;.\libs\resolver.jar;.\libs\xbean.jar;.\libs\xbean_xpath.jar;.\libs\xmlbeans-qname.jar;.\libs\xmlpublic.jar" excelsifter.ExcelSifterController

This is all on one line. I tried / instead of \, but that didn't seem to work. Everything I could find on this indicates that for windows you have to use the backslash. All the dependencies are here, as far as I know. At least my mac doesn't complain when I use essentially the same command.

My directory containing my .bat file contains the excelsifter package (a folder called excelsifter) and the folder libs with all the jar files in it. Thanks, John


Your starting string looks ok to me, try to check if there are other dependencies in the libraries you use as @Said mentioned. The best way is to search for class your java cannot find, probably you'll find it declaration in some other library you didn't included in your classpath.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜