A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Android Security Essentials Live Lessons
this week in the
call java program from script?
Joined: Nov 03, 2004
Apr 15, 2005 20:00:00
I am a linux newbie but I want to call
program from a shell script
it is a bash shell and is it also possible to pass variables to the java program when it is called?
author and iconoclast
Joined: Jul 08, 2003
Apr 15, 2005 20:08:00
Sure., Just run the program as "java ClassName arg1 arg2 ...", where ClassName is the name of the main class, and arg1, etc, are the command-line arguments to the program. There are, of course, class path issues, etc, but this is the basic idea.
[Jess in Action]
Joined: Mar 22, 2004
Apr 19, 2005 19:46:00
You can also launch a jar file, provided it has a manifest that points to the class where the main method is:
java -jar myJarToLaunch
I agree. Here's the link:
subject: call java program from script?
Linux script to call a java program
how to execute shell script from java class
Callling a Script from a java program
How to call Java program main method from shell script
ftp files to a different server
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014