Operating System - OpenVMS
1830242 Members
2129 Online
109999 Solutions
New Discussion

Re: Java failure on exec call?

 
SOLVED
Go to solution
Sandeep_30
Occasional Advisor

Java failure on exec call?

I am running this java code on Itanium machine with Java version 1.4.2 and VMS version 8.2,

import java.lang.*;

public class Example1
{
public static void main(String args[])
{
int ExitCode=0;
try
{
Runtime r = Runtime.getRuntime();
System.out.println("Executing TESTJOB");
Process p = r.exec("@OVMS01$DKA100:[SYS0.SYSMGR.TESTING]TESTJOB.COM");
ExitCode = p.waitFor();
}
catch (Exception ex)
{
System.out.println("Error: Could not launch TESTJOB. Mes
sage is :" + ex.getMessage());
}
}
}

When I run the above code, below is the Exception message I receive,

$ java "Example1
Executing TESTJOB
Error: Could not launch TESTJOB. Message is :Child creation error: error 100052
VMS error code: error 100052

Please help.
Thanks
Sandeep

6 REPLIES 6
Garry Fruth
Trusted Contributor

Re: Java failure on exec call?

For what it's worth, error 100052 is "%RMS-F-SYN, file specification syntax error".
John Gillings
Honored Contributor
Solution

Re: Java failure on exec call?

Sandeep,

Look at the definition of the r.exec function. Does it expect a command string or the name of an image to execute? I suspect it's the image name, in which case the "@" in the filespec is incorrect and would account for the RMS-F-SYN error.

As a test, try replacing the string with "OVMS01$DKA100:[SYS0.SYSMGR.TESTING]HELLOWORLD.EXE"

It may also accept just the name of the command procedure, so try leaving off the leading "@".

There may be another routine to call to execute an arbitrary DCL command (maybe "system"?).
A crucible of informative mistakes
Antoniov.
Honored Contributor

Re: Java failure on exec call?

Sandeep,
I'm with John; r.exec is like spawn c function and I guess you can run only binary imaged (.exe).
You have to search the equivalent method of system c function.

Antonio Vigliotti
Antonio Maria Vigliotti
Bojan Nemec
Honored Contributor

Re: Java failure on exec call?

Sandeep,

I try yours example on an alpha 7.3-2 same Java version. Same error reported. Johns suggestion works. So you must omitt the @.
Now the strange things. I write the testjob.com like this:

$ open/write f test.dat
$ write f p1," ",p2," ",p3
$ close f

Now I have replaced the
r.exec("@OVMS01$DKA100:[SYS0.SYSMGR.TESTING]TESTJOB.COM"); in
r.exec("OVMS01$DKA100:[SYS0.SYSMGR.TESTING]TESTJOB.COM a b c");

The contents of the test.dat is supposed to be:
a b c
but they are:
OVMS01$DKA100:[SYS0.SYSMGR.TESTING]TESTJOB.COM a b

So pay attention when passing arguments. (The same is when you use an array of strings).

Bojan
Sandeep_30
Occasional Advisor

Re: Java failure on exec call?

Appreciate your help.

Thank you all for your replies.
Sandeep_30
Occasional Advisor

Re: Java failure on exec call?

The replies were helpful in finding resolution to my question.