Install on Windows
Hagane COBOL is built with Visual Studio (for cobj.exe) and a JDK (for libcobj.jar). It is tested with OpenJDK 21.
1. Prepare the tools
- Install Visual Studio with the Desktop development with C++ workload.
- Install a JDK.
- Download the source code of the latest release and extract it.
2. Build cobj.exe
- Open
win/opensourcecobol4j.slnwith Visual Studio. - Select the Release configuration.
- Click Build → Build Solution.
cobj.exe is created in win/x64/Release.
3. Build libcobj.jar
Open PowerShell in the source directory and run:
powershell
cd libcobj
.\gradlew shadowJarlibcobj.jar is created in libcobj\app\build\libs\.
4. Install the files
Run make-install.ps1 in the win directory:
powershell
cd win
.\make-install.ps1The files are placed as follows:
| File | Location |
|---|---|
| cobj.exe | C:\opensourcecobol4j\bin |
| libcobj.jar | C:\opensourcecobol4j\lib |
| config files | C:\opensourcecobol4j\config |
| copy files | C:\opensourcecobol4j\copy |
TIP
If you built the Debug configuration, change \x64\Release\cobj.exe in win/make-install.ps1 to \x64\Debug\cobj.exe.
5. Set the environment variables
- Add
C:\opensourcecobol4j\bintoPATH. - Set
CLASSPATHto.;C:\opensourcecobol4j\lib\libcobj.jar. The leading.is needed to run the programs in the current directory.
Open a new terminal and check the installation:
powershell
cobj --versionNext, see Usage to compile and run your first program.