As mentioned previously, the OpenLaszlo compiler is based on Java. Therefore, before you can start compiling LZX programs, you need to download and install the Java Development Kit (JDK) as well as configure some system environment variables.
The JDKs for Windows, Linux, and UNIX can be downloaded from this URL:
http://java.sun.com/j2se/1.5.0/download.jsp
Note
The link above will download Java version 5. If you like, you can also use Java 6, which is also already available.
Once you click the link, you’ll be redirected to a page that lets you select an installation for your platform: Windows, Linux, or Unix. The 64 bit versions for certain platforms are available. Also, note that the same link also provides the Java Runtime Environment (JRE). However, you need the JDK, and the JDK includes the JRE.
Note
For Macintosh, download the JDK from this URL: http://developer.apple.com/java/download/
After obtaining the JDK, you need to install it. Installation varies from one operating system to another. These subsections detail the installation process.
Installation on Windows is easy. Simply double-click the icon of the executable file you downloaded and follow the instructions.
On these platforms, the JDK is available in two installation formats.
Self-extracting binary file. This format can be used to install the JDK in a location you choose and you do not need to be a root user.
Packages. A compressed file containing packages to be installed.
If you are using the self-extracting binary installation, follow these steps.
1. | Use chmod to give the file the execute permissions: chmod +x shFile Here, shFile is the downloaded sh file for your platform. |
2. | Change directory to the location where you would like the files to be installed. |
3. | Run the self-extracting binary. Execute the downloaded file with the path prepended to it. For example, if the file is in the current directory, prepend it with “./” (necessary if “.” is not in the PATH environment variable): ./shFile |
If you downloaded the JDK in the package format, see the following URLs:
http://java.sun.com/j2se/1.5.0/install-linux.html http://java.sun.com/j2se/1.5.0/install-solaris.html
After you install the JDK, you can start compiling and running Java programs. However, you can only invoke the compiler and the JRE from the location of the javac and java programs or by including the installation path in your command. To make compiling and running programs easier, it is important that you set the PATH environment variable on your computer so that you can invoke javac and java from any directory.
To set the PATH environment variable on Windows NT, Windows 2000, and Windows XP, do these steps:
1. | |
2. | Double-click System. |
3. | on Windows NT, select the Environment tab. On Windows 2000 and Windows XP select the Advanced tab and then click on Environment Variables. |
4. | Locate the Path environment variable in the User Variables or System Variables panes. The value of Path is a series of directories separated by semicolons. Now, add the full path to the bin directory of your Java installation directory to the end of the existing value of Path. The directory looks something like: C:Program FilesJavajdk1.5.0_<version>in |
5. | Click Set, OK, or Apply. |
Set the path environment variable on these operating systems depends on the shell you use.
For the C shell, add the following to the end of your ~/.cshrc file:
set path=(path/to/jdk/bin $path)
where path/to/jdk/bin is the bin directory under your JDK installation directory.
For the Bourne Again shell, add this line to the end of your ~/.bashrc or ~/.bash_profile file:
export PATH=/path/to/jdk/bin:$PATH
Here, path/to/jdk/bin is the bin directory under your JDK installation directory.
To confirm that you have installed the JDK correctly, type javac on the command line from any directory on your machine. If you see instructions on how to correctly run javac, then you have successfully installed it. On the other hand, if you can only run javac from the bin directory of the JDK installation directory, your PATH environment variable was not configured properly.