• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

call java program from script?

 
david lightman
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a linux newbie but I want to call java 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?

thanks
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also launch a jar file, provided it has a manifest that points to the class where the main method is:


--Dale--
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic