views:

62

answers:

1

Hi,

i've been given the task of creating a ksh script which runs one Java program multiple times and another once. The idea is that the multiple runs test the ability of the single program to handle multiple threads.

The issue i am having is that i want to use a .Launch file generated by Eclipse to specify the run time dependencies of the two Java programs and i have no idea how to do this via command line in either Windows or Unix.

Can any body help me??

cheers.

+2  A: 

To me it sounds like trying to link an IDE environment to an application running outside of the IDE is problematic, and a bit squirrly. Rather than trying to figure out how to "use" the .Launch file, roll up a jar file and run the application that way. For Eclipse, just right click the project, pick export, then navigate to a runnable jar file. It should be pretty straight forward.

Bill
To be hones that doesn't really answer my question. I still want to use the .Launch files, but i am willinging to try something else which has the same effect.How do i run the jar from command line once i've made one??
matt2010
@matt why do you want to use the launch files. The jar is perfectly acceptable and also reasonable.
Chris
Its just the way that i've been told i should do it by a collegue so i'm investigating it. I'm not over experienced in using jar files in terms of running them directly from a script.Could you help me in terms of syntax in how to run them and seeing results of testing??
matt2010
I've made the JAR file and run it but i'm getting some serious errors which i don't get in Eclipse.Any ideas why this would be?
matt2010
@matt once you've created a runnable jar, run it with 'java -jar jarname.jar' If you are getting errors, it means you probably don't have all the needed libraries included. When you are creating the runnable jar via eclipse, make sure you have the 'Extract required libraries into generated JAR' option. Even if a colleague told you to run it with a .launch file, that doesn't mean he is right.
Bill
That's what i did, i also had some vm arguments which i needed to specify so i just did 'java -jar jarname.jar -DMyVMArgument -DMyVMArgument' is this correct??
matt2010
If you run 'java -?' it will show you options available to run. The '-D' option is to set a system property, usually something like predetermining the amount of memory available for the program. If your program runs fine from within Eclipse, then you may not need to have any additional java options other than '-jar'. If you are running into errors, then you need to debug the errors. If you can't figure out the errors out, then posting them under a separate question might be warranted.
Bill
Thanks Bill. I relised that i should add the arguments before specifying the JAR file. I'm still getting multiple errors, but atleast i now know for sure that i am adding the arguments correctly.
matt2010