tags:

views:

82

answers:

1

I need to create a .bat file to run java program. I have a DatabaseConnect.class file under "C:\Program Files\Java" directory. And I have a jar files for database connection in "C:\Program Files\JarColl" directory.

I tried but no success . ANy help is appreciated.

+2  A: 

Most likely Path problem.

Try this?

java -classpath "C:\Program Files\JarColl\\*";C:\Program Files\Java DatabaseConnect
sarahTheButterFly
There is a space between 'Java' and 'DatabaseConnect'
sarahTheButterFly
Reading the formatting help helps ;-)
Joey
Thanks Johannes. :-)
sarahTheButterFly
why there is a double quote for jars and not for class name.is that the only line i need to put in the .bat file.
@user234194: Without double quotes java will interpret a space character as the end of the classpath parameter. As the name of the class doesn't/can't have spaces, it doesn't need quotes. As for your second question, that should be all you need to put in the .bat file (although, I'd suggest you just try it rather than coming back here and asking - it's much faster).
Catchwa