Skip to main content

I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

Do you have JAVA_LIBRARY_NAME=jvm.dll set up as an environment variable on windows. A fully qualified path can be added with the name. Also, add the location of jvm.dll/libjvm.so to the PATH environment variable. On windows, the entry will look like: PATH=<additional path info>;C:\\Program Files\\Java\\jdk1.5.0_03\\jre\\bin\\client;

For convenience, it may be helpful to have the Java bin directory in the PATH as well. On windows, that

directory might be C:\\Program Files\\Java\\jdk1.5.0_03\\bin.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

I have the PATH set up correctly.  I also had JAVA_LIBRARY_NAME in my config file and not as an environment variable but putting it there didn't make any difference either.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

You should add a line like this in your config file:

JAVA_OPTIONS    -Djava.class.path=/path/to/directory

The value beyond the = can be a colon-separated (Unix) or semicolon-separated (Windows) list of locations to search for classes.  Each element in the list should be either a directory or the name of a .jar file.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

In the JavaInteropInstructions.txt file it says "For Java calling COBOL, JAVA_OPTIONS should specify ...".  I'm trying COBOL to Java.

I did put this into the config and gave it a shot but still have the same results.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

In the JavaInteropInstructions.txt file it says "For Java calling COBOL, JAVA_OPTIONS should specify ...".  I'm trying COBOL to Java.

I did put this into the config and gave it a shot but still have the same results.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

In the JavaInteropInstructions.txt file it says "For Java calling COBOL, JAVA_OPTIONS should specify ...".  I'm trying COBOL to Java.

I did put this into the config and gave it a shot but still have the same results.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

Are your Java objects (class files) in the runtime bin directory or somewhere else?


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

They were in another directory.  I tried moving them to the runtime bin directory but still have the same results.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

Are you able to get the sample programs to run? C:\\Program Files (x86)\\Micro Focus\\Acucbl921\\AcuGT\\sample\\java

I notice you call javamain, but wonder if you should be calling Java-new CALL "C$JAVA" USING CJAVA-NEW, "name-of-your-java-object", "()V" GIVING OBJECT-HANDLE.


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

You are correct that it's needed for Java calling COBOL, so Java can find the CVM.jar file.  But it's also needed for COBOL calling Java, so that your Java classes can be located. If this isn't set correctly, you get the "class not found" error. Not sure what's causing the Invalid Arg error.

What platform and ACUCOBOL version are you testing this with?


I am having troubles trying to implement a call to a Java program using "C$JAVA".  Here is my Java code:

public class TestClass {

// Main
public static void main(String arg1) {
System.out.println("test");
System.out.println( "TestClass: main command line argument 1: " arg1 );
}

public void testMethod(String arg1)
{
System.out.println("test");
System.out.println( "testClass: testMethod argument 1: " arg1 );
}

}

When I try calling the main I get a return of -1 (Invalid Arg):

CALL "C$JAVA" USING CJAVA-CALLJAVAMAIN, "TestClass", "String1" GIVING STATUS-VAL.

When I try calling the testMethod I get a return of -3 (Class not found):

CALL "C$JAVA" USING CJAVA-CALLSTATIC, "TestClass", "testMethod", "(X)V", "String1" GIVING STATUS-VAL.

Can anyone help me out with this?  I've also tried taking out the argument to Main but still get the -1 error.

Thanks!


#CJAVA

I was finally able to get the sample program working by changing to use the CJAVA-NEW and CJAVA-CALLNONVIRTUAL calls.  I know I tried that before, but I must have had something off.

However, when I switch this over to the actual Java program I am using, the InvalidArg error returns.  I believe I have this narrowed down to some code that throws a couple exceptions.  I verified it was that part of the code by commenting out those lines, calling it again and getting a Success returned.

Even though they are in private methods and I am catching them within those methods, I'm still getting the -1 returned.  I have added the check for the exception, but that's a value -13.

Is there anything else I need to add to either program?  Thanks!