Skip to content

Install opensource COBOL 4j v1.0.3

yutaro-sakamoto edited this page Jul 19, 2022 · 1 revision

We have confirmed that opensource COBOL 4j works on CentOS8.

Manual install

Install dependencies

Run the following command.

rpm --import http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems &&\
curl -o /etc/yum.repos.d/zulu.repo http://repos.azulsystems.com/rhel/zulu.repo &&\
dnf install -y gcc gcc-c++ make bison flex gmp-devel ncurses-devel zulu-14 unzip automake autoconf libtool &&\
ln -s /usr/bin/aclocal /usr/bin/aclocal-1.13 &&\
ln -s /usr/bin/automake /usr/bin/automake-1.13

Download opensource COBOL 4j v1.0.3 and JDBC for SQLite

Run the following command.

curl -L -o opensourcecobol4j.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.0.3.tar.gz &&\
curl -L -o libcobj.jar              https://github.com/opensourcecobol/opensourcecobol4j/releases/download/v1.0.3/libcobj-1.0.3.jar &&\
curl -L -o sqlite.jar               https://github.com/xerial/sqlite-jdbc/releases/download/3.36.0.3/sqlite-jdbc-3.36.0.3.jar &&\
tar zxvf opensourcecobol4j.tar.gz

Set CLASSPATH

After running the command in the previous section, there exist libcobj.jar and sqlite.jar in the current directory.
Add libcobj.jar and sqlite.jar to the environment variable $CLASSPATH.

Install opensource COBOL 4j

Move into the directory 'opensourcecobol4j-1.0.3' and run the following command.

./configure --prefix=/usr/ &&\
make install &&\
cd ../ &&\
./configure --prefix=/usr/ --with-vbisam &&\
make install

Install with Docker

The docker container for opensource COBOL 4j is available.

docker pull opensourcecobol/opensourcecobol4j:1.0.3

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.
$ cobc HELLO.cbl

# The cobc compiler produces HELLO.java and HELLO.class
$ ls
HELLO.cbl  HELLO.class  HELLO.java

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