Skip to content

Install opensource COBOL 4J v1.0.8

yutaro-sakamoto edited this page Nov 6, 2023 · 5 revisions

We have confirmed that opensource COBOL 4J v1.0.8 works on Ubuntu and AlmaLinux.

Manual install

Install dependencies

Run the following command.

sudo apt-get update
sudo apt-get install default-jdk
sudo apt-get install -y build-essential bison flex gettext texinfo libgmp-dev autoconf

Install SQLite JDBC Driver

Run the following command.

mkdir ~/.java_lib
curl -L -o ~/.java_lib/sqlite.jar https://github.com/xerial/sqlite-jdbc/releases/download/3.36.0.3/sqlite-jdbc-3.36.0.3.jar
export CLASSPATH=":$HOME/.java_lib/sqlite.jar"

Install opensource COBOL 4J

curl -L -o opensourcecobol4j-v1.0.8.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.0.8.tar.gz
tar zxvf opensourcecobol4j-v1.0.8.tar.gz
cd opensourcecobol4j-1.0.8
./configure --prefix=/usr/
make
sudo make install

Set $CLASSPATH

Add /usr/lib/opensourcecobol4j/libcobj.jar and ~/.java_lib/sqlite.jar to the environment variable $CLASSPATH.

Install with Docker

The docker container for opensource COBOL 4J is available.

docker pull opensourcecobol/opensourcecobol4j:1.0.8

Execute the following commands in order to run the "Hello World" COBOL program.

# Move to the sample directory
$ cd /root/cobol_sample

# Translate COBOL to Java and compile the Java source file.
$ cobj HELLO.cbl

# Run "Hello World"
$ java HELLO
HELLO WORLD!
Clone this wiki locally