OJ Installing and Setting-up TIPS

Last Modified on .

Download ...

Download the compressed file from Download Page.

Extract ...

Extracts the package from the compressed file.

  • *.tar.gz
    You can use GNU version of tar command tool or combination of gunzip and tar command tools.
    In shell environment,
      % tar -zxvf OpenJava_19991124.tar.gz
      % gunzip -c OpenJava_19991124.tar.gz | tar -xv
  • *.jar
    You can use jar command tool included in Sun's JDK package to extract files form this compressed file. We suppose you can do that with any other zip tools.
    In Windows DOS-prompt,
      C:\> jar -xvf OpenJava_19991124.jar

You can put the OJ directory anywhere you like.

Class Path ...

Setting up the class path.

Extracts the package from the compressed file.

  • Use the ojc shell-script in bin directory. The script requires /usr/bin/ksh.
  • Set CLASSPATH environment variable to include the OJ directory, the directory in which the "openjava" directory exists.
    • For example in UNIX, imagine that OJ directory is at:
      To set up your class path, run the command as follows:
        % setenv CLASSPATH /home/mich/OpenJava_1.0:....
    • For example in Windows, imagine that OJ directory is at:
      To set up your class path, run the command as follows:
        C:\> set CLASSPATH=C:\OpenJava_1.0;....
    Do not forget to include paths to your classes in the class path. One of the paths is often the current directory, '.'.

Run ...

Some Windows version of JDK have a problem in running OJ compiler. Try to turn off the JIT in this case.

Compiler ...

If you want to use any special regular Java compiler, try to implement a class with the interface openjava.ojc.JavaCompiler and specify that class as a -compiler command option of ojc. For example with JP.ac.tsukuba.openjava.NullCompiler, which is a compiler doing nothing, you can use this special compiler by:

  ojc -compiler=JP.ac.tsukuba.openjava.NullCompiler ...

JP.ac.tsukuba.openjava.SunJavaCompiler is the default class to be used by the system for compiling regular Java source code to generate byte code.

Binding ...

In OJ, a class without specification of its metaclass are to be an instance of the default metaclass openjava.mop.OJClass. In the case to change the default class for certain classes, you can specify that in a separated file. For instance, to make the classes Hello and Bye instances of the metaclass VerboseClass, you should write a file MyBinding of the following content:

  VerboseClass Hello
  VerboseClass Bye
Note that any class name in the file must be qualified name. Then, with the command option of ojc,
  ojc ---default-meta=MyBinding Hello.oj Bye.oj
the metaclass for each class would be the VerboseClass if its metaclass specification were omitted.

As it is an on-going work, either the format of separeted specification files or the way of giving command line option may change.

OJ Home
Copyright (C) 1999 by Michaki Tatsubori.
Java(TM) is a trademark of Sun Microsystems, Inc.