Thursday, November 13, 2014

MLj Tips: MLj set up and installation

After some trials and errors I managed to run my MLj in my machine. A lot of mistakes I made because I can't find any good tutorial out there. So, I write one for myself. You can read about MLj here.

Here are some steps that I did when setting up MLj in my machine:

1. Get the MLj for Linux

http://www.dcs.ed.ac.uk/home/mlj/dist/downloads/mlj0.2c-linux.tar.gz

2. Install the SMLNJ

You can install the SMLNJ using this command:
$ sudo apt-get install smlnj

3. Extract mlj0.2c-linux.tar.gz

You can extract your mlj package somewhere in your drive. It will contain mlj as the root directory.

4. Go to your mlj/bin directory

Open and go to your mlj/bin directory. You'll find 4 files there. They are mlj, mlj.bat, mlj-jdk1.1.1.x86-linux, and run.x86-linux.

5. Try to run the mlj

Use this command to run the mlj:
$ ./mlj    

Probably it will raise this kind of error:
./mlj: 1: ./mlj: .arch-n-opsys: not found
 mlj: unable to determine architecture/operating system

to fix this, you can set your PATH environment variable using this command:
$ export PATH=$PATH:<your mlj/bin path>

or

you can open and edit your mlj file and change this part of code:
ARCH_N_OPSYS=`.arch-n-opsys`
to    
ARCH_N_OPSYS=`./.arch-n-opsys`

Try run ./mlj or mlj once again. and the error is still there. Because the .arch-n-opsys file is not compatible with current desktop architecture environment. It's okay, we will get rid of it in the next step. 

mlj: unable to determine architecture/operating system

6. Copy .arch-n-opsys file from your smlnj

You may create backup of your current .arch-n-opsys file if you want and then copy the new one from the smlnj directory. Here are the commands:
$ mv .arch-n-opsys .arch-n-opsys.bak
$ cp /usr/lib/smlnj/bin/.arch-n-opsys .

7. Try to run mlj once again

Try to run ./mlj or mlj again and you'll get this view:

MLj 0.2c on x86 under Linux with basis library for JDK 1.1
Copyright (C) 1999 Persimmon IT Inc.

MLj comes with ABSOLUTELY NO WARRANTY. It is free software, and you are
welcome to redistribute it under certain conditions.
See COPYING for details.

Your installation is done!

If you have any question or find my post useful please leave a comment. 

No comments:

Post a Comment

Finally, C# 9 record, the equivalent of Scala's case class

While C# is a wonderful programming language, there is something that I would like to see to make our life programmer easier. If you are fam...