Skip to main content

I am evaluating Microfocus Enterprise Developer in part to make a Java 1.8 call to a 64 bit COBOL executable on Unix. When I build for Unix, the output is an obj file. The question is how can we call this in Unix from JAVA. I know on windows i can load a DLL using System.load() in Java - what is the equivalent when calling an obj file on Unix?


#jdk1.8
#Java
#64bitcompilationissue

I am evaluating Microfocus Enterprise Developer in part to make a Java 1.8 call to a 64 bit COBOL executable on Unix. When I build for Unix, the output is an obj file. The question is how can we call this in Unix from JAVA. I know on windows i can load a DLL using System.load() in Java - what is the equivalent when calling an obj file on Unix?


#jdk1.8
#Java
#64bitcompilationissue

When you build for Unix/Linux the output will be either an executable file or a shared object with the extension .so (may differ depending on system). These .so files are akin to a .dll under Windows.

In either environment you should be using the COBOL Java run-time library calls to load and run your COBOL applications. This is documented under the section Java and COBOL

From Java you should be loading the COBOL modules using the cobload function:

{  
  if (RuntimeSystem.cobload("mycbl") != 0)
     System.out.println("Could not load library\\n") ;
  else
     System.out.println("Library loaded successfully\\n") ;
}

And to call the COBOL you should be using one of the cobcall functions:
import com.microfocus.cobol.* ;
class SimpleCall
{
   public static void main(String argv[]) throws Exception
   {
       int i = RuntimeSystem.cobcall_int("legacy", 
		            	new ParameterList()
	                   			.add((int)4
                      	.add((int)7
                   				.add((byte)'a'));
       System.out.println(i) ;
   }
}

Please look at the documentation using the link that I provided above.

Thanks.


I am evaluating Microfocus Enterprise Developer in part to make a Java 1.8 call to a 64 bit COBOL executable on Unix. When I build for Unix, the output is an obj file. The question is how can we call this in Unix from JAVA. I know on windows i can load a DLL using System.load() in Java - what is the equivalent when calling an obj file on Unix?


#jdk1.8
#Java
#64bitcompilationissue

Thank you Chris but Enterprise Developer did NOT generate an .so file - only .obj and idy - when I set the LINK target OS for Uni/Linux.  For Windows I do get a DLL. I do not believe I can generate an .so file from NetExpress either.


I am evaluating Microfocus Enterprise Developer in part to make a Java 1.8 call to a 64 bit COBOL executable on Unix. When I build for Unix, the output is an obj file. The question is how can we call this in Unix from JAVA. I know on windows i can load a DLL using System.load() in Java - what is the equivalent when calling an obj file on Unix?


#jdk1.8
#Java
#64bitcompilationissue

You cannot generate an .so file if you are running under Windows. There is an add-on to the ED Eclipse product for doing remote development under Unix that would be required to actually generate a Unix/Linux executable on the target machine.

For Visual COBOL it is called the Development Hub but for Enterprise Developer it is called Micro Focus Enterprise Developer UNIX Components, I believe.

You will need this add-on if you are developing apps that target Linux/Unix systems.