Hi all

I have a program that is written in java and have three different executables program.sh, program.bat, program.jar.

i can starts the gui by using program.jar and then in gui i can enter parameters. but as i want to run it over several parameters and get the outputs.

i am just wondering i I can use program.bat on windows command line or program.sh on unix so that i can pass parameters on command line and run it.

I tried ./program.sh but it gave an error permission denied

They have given a command how to run program using jar from linux

#!/bin/sh
#
# Run program from a jar file
# this is a linux-only version
#-------------------------------------------------------------------------------

java -Xmx1024M -cp program.jar islab.bayesian.genenetwork.generation.NetworkGeneratorCLI $*

after this command output is - Usage: NetworkGeneratorCLI <ini-file>

Can anyone please guide me, how can i pass parameters on command line instead of using GUI.

Thanks

Windows:
javaw -jar myJar.jar arg1 arg2

Windows:
javaw -jar myJar.jar arg1 arg2

Works only if MANIFEST has required mainClass entries. Can't assume all jars have it.

I don't really understand what's the problem here. They've given you the command, which seems to be simple enough. Just run it!

Call the script like this: xyz_script.sh C:\init_file.ini

Works only if MANIFEST has required mainClass entries. Can't assume all jars have it.

Yes, true, but OP did say he can start the jar, so manifest is obviously OK in this case.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.