Skip to content

opensource COBOL 4j v1.0.3のインストール

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

opensource COBOL 4jはCentOS8での動作を確認しています。

手動インストール

依存ライブラリのインストール

下記のコマンドを実行する。

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

opensource COBOL 4j v1.0.3 と JDBC(SQLite)をダウンロードする

下記のコマンドを実行する。

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

CLASSPATHを設定する

上記のコマンドを実行すると,libcobj.jarとsqlite.jarがダウンロードされる。 この2つのファイルにCLASSPATHを通す。

opensource COBOL 4jをインストールする

'opensourcecobol4j-1.0.3'ディレクトリに移動し、下記コマンドを実行する。

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

Dokcerによるインストール

下記のコマンドで、opensource COBOL 4jをインストールしたDockerイメージをダウンロードできる。

docker pull opensourcecobol/opensourcecobol4j:1.0.3

コンテナ内で下記のコマンドを実行すると、Hello Worldプログラムをコンパイル&実行できる。

# 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