I want to compile and run a file which uses three jar files as resources

hello everyone

I seek help in a problem am having.

I have a package called Classes which has several classes. (ClassA.java, ClassB.java) and I have a lib folder containing three jar files which i need to compile my classes (A.jar, B.jar, C.jar).

Am trying to create two .bat (compile.bat, run.bat)files one to compile my classes and the other to run my application (main class is ClassA.java). I want the compiled classes to be in the same folder as the java files. My class hierarchy is like this

MyApp

|

|

|--compile.bat

|--run.bat

|--lib

||

||

||-A.jar

||-B.jar

||-c.jar

|

|-Classes

||-ClassA.java

||-ClassB.java

Can someone help me right the two .bat files, it will be greatly appreciated (this app runs on windows).

[842 byte] By [franklinia] at [2007-10-2 15:57:54]
# 1
for to compile:javac -cp lib -sourcepath Classes -d Classesfor runningjava -cp lib;Classes Classes\ClassA.classDepending on your system environment and your bat you may have to use direct pathes instead of relative pathes.
woidl007a at 2007-7-13 16:21:24 > top of Java-index,Developer Tools,Java Compiler...
# 2
Thanks so much. You are a God sent. I will try the code later today and hopefully all will be well
franklinia at 2007-7-13 16:21:24 > top of Java-index,Developer Tools,Java Compiler...
# 3

> for to compile:

> javac -cp lib -sourcepath Classes -d Classes

>

> for running

> java -cp lib;Classes Classes\ClassA.class

>

> Depending on your system environment and your bat you

> may have to use direct pathes instead of relative paths.

That won't work. You need to explicitly name your jars in your classpath, or use java_ext_dirs

Read [url=http://mindprod.com/jgloss/classpath.html]what Roedy has to say on classpath[/url].

tschodta at 2007-7-13 16:21:24 > top of Java-index,Developer Tools,Java Compiler...