It's not a secret anymore!
The moose likes Linux / UNIX and the fly likes Executing JAVA code from shell script and grep the result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Executing JAVA code from shell script and grep the result" Watch "Executing JAVA code from shell script and grep the result" New topic
Author

Executing JAVA code from shell script and grep the result

P B Madhavan
Greenhorn

Joined: Dec 23, 2009
Posts: 5
Hi All,

I am new to Unix. I have a question

I have a requirement to execute a JAVA class from Unix shell script.

I need to then grep for a key word "NOTOK" that is rendered by a System.out.println statement of the JAVA Class.

If I find the word, then I need to echo a message.

Could you kindly help me with this requirement?


Regards,

Madhavan
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17148
    
  27

java my.app.MainClass | grep NOTOK && echo "something"

An IDE is no substitute for an Intelligent Developer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Executing JAVA code from shell script and grep the result
 
It's not a secret anymore!