Hi all,

I am a new joinee in this forum. I am facing one problem.

How to call Java classes and methods from shell scripts?? i am using KSH.

Is it really possible to do that or not?

Response will be appreciated.

Girish Sharma

Recommended Answers

All 3 Replies

The only java method you can call from a shell script is the main method
of a class, by starting that class with a java command line execution.

Can we define exit status intereger values for our purpose except 0?

like can i set custom exit status messages:

"1" for error occured because of reason #1
"2" for error occured because of reason #2

Is there any document which displays all the exit status code values from 0-255?

Your exit status from your java program is whatever number you place
in the System.exit call. There is no standard exit code value other than
0 is successful and not 0 is an error. I would say you are probably pretty
safe using return codes between 50 and 200, just a personal guess. I
have never actually seen the jvm die with an error code other than 0, 1,
254, or 255.

Be a part of the DaniWeb community

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