Operating System - OpenVMS
1752328 Members
5174 Online
108786 Solutions
New Discussion юеВ

Java exit code 1.5 en 6.0 and VMS exit code

 
SOLVED
Go to solution
Toine_1
Regular Advisor

Java exit code 1.5 en 6.0 and VMS exit code

Hello,

I schedule some java programs on a VMS server via a command file.
When the application ends normally it is doing a system.exit(1);

This means that the $severity is also 1 and $status is %X10000001 in my command file and successfully ended.

This worked in Java 1.5.

In Java 6 this doesn't work anymore.
system.exit(1) is translated to $severity is 2. And $status is %X1035A00A.

Is this normal?
Can I set some logicals to have the same behavior as in Java 1.5.

/Toine
5 REPLIES 5
Steven Schweda
Honored Contributor

Re: Java exit code 1.5 en 6.0 and VMS exit code

ALP $ sysmsg %X1035A00A
(SYS$COMMON:[SYSMSG]DECC$MSG.EXE;1:)
%C-E-EXIT1, exit value 1

Looks like a compile-time decision:

HELP CRTL exit
WW304289
Frequent Advisor

Re: Java exit code 1.5 en 6.0 and VMS exit code

> Looks like a compile-time decision:

Yes. Compile program below with and without /define=_POSIX_EXIT , run it and check $status:

#include
int main() { exit(1); }

Thanks,
-Boris
Steven Schweda
Honored Contributor

Re: Java exit code 1.5 en 6.0 and VMS exit code

> Looks like a compile-time decision:

Of course, it _is_ possible to call either
plain [decc$]exit() or __posix_exit()
explicitly, and so it is possible to make a
run-time decision about which one to use.

Knowing nothing, I'd guess that the people
moving Java to VMS did some easy thing, like
define _POSIX_EXIT, when they built the
stuff, so I'd guess that there's no run-time
flexibility. But I haven't looked hard at
the Java-on-VMS documentation to see if
there's anything relevant (and revealing)
there.
Tim E. Sneddon
Occasional Advisor
Solution

Re: Java exit code 1.5 en 6.0 and VMS exit code

There were some changes to the way that Java returns values with the release of version 6.0. The following link contains details of how to use the JAVA$EXIT_ENV logical to control this behaviour.

http://h18012.www1.hp.com/java/documentation/1.6.0/ivms/docs/user_guide.html#exitmode

It seems that POSIX is the default (which would explain what you're experiencing).

Tim.
Toine_1
Regular Advisor

Re: Java exit code 1.5 en 6.0 and VMS exit code

Hi Tim,

Thanks for the answer. This is what I'm looking for.

I should read the release notes !!

$ define JAVA$EXIT_ENV COMPAT solved my problem.

============================================

Controlling exit mode
Beginning with JDK 6.x, a new logical, JAVA$EXIT_ENV, is introduced to control the exit mode of the JDK. Four modes are supported:

COMPAT:

Any value returned by the exit function is masked with %x10000000.
Any value returned by waitForProcessExit is returned unchanged.
This is the mode used for all JDKs before JDK 6.x.
POSIX:

Return value of the exit function:
Any value less than 256 is converted to match the C RTL POSIX exit code.
Any value over 255 is returned as the value with the inhibit mask.
Return value of the waitForProcessExit method:
Values of 0 or 1 are returned as a 0.
The CRTL POSIX exit code 1 (3514378) is returned as a 1.
Values between 3514379 and 3516409 are converted back to POSIX-style exit values, which are from 2 to 255.

POSIXVMS:

Same as POSIX mode, with one exception: For values 0 and 1, the waitForProcessExit method is returned as 1.
POSIX0AND1:

Same as POSIX mode, with one exception: For values 0 and 1, waitForProcessExit is returned with the exact value received.
The default mode for JDK 6.x is POSIX.



/Toine