User Tools

Site Tools


compilers:install_windows
Return to Home page

Install Jflex, CUP and Java in Windows

Guide on how to install Java, Jflex and CUP in the Windows operating system.

Java

The Oracle JDK can be downloaded at the following address https://www.oracle.com/java/technologies/javase-jdk14-downloads.html, choosing the one marked as Windows x64 Installer (at the moment of this guide the recommended version to download is jdk-14_windows-x64_bin.exe).

JFlex and CUP

You can choose to install JFlex and CUP either using the installer we provide you or by following the installation steps manually.

Installer

The setup package requires that the JDK is installed on the machine, so make sure you did not skip the previous step or you already had a working Java installation. Download the setup file at the following address FLC Tools installer and run it with administrator privileges.
FLC Tools installs both Jflex and CUP and properly configures the system environment variables. To check if everything works, please refer to the Check installation paragraph.
If you have problems using the installer, try following the instructions in the Manual installation) paragraph.

Manual installation

1. Create a folder named FLC_Tools in the desired path (e.g. C:\Program Files, C:\Program Files (x86), or in your Desktop).

2. Copy the folders java_cup_v11_draw_tree and jflex-1.8.1 (that you can find in this zip file) inside FLC_Tools, in order to have the two paths [installdir]\FLC_Tools\java_cup_v11_draw_tree and [installdir]\FLC_Tools\jflex-1.8.1 (where [installdir] is the path you chose in step 1).

3. Open a command prompt with administrator privileges and execute the following commands literally and in the exact same order (each line is a different command), replacing each time [installdir] with the appropriate value.

echo "[installdir]\FLC_Tools\java_cup_v11_draw_tree\StdDraw.java" >> "[installdir]\FLC_Tools\java_cup_v11_draw_tree\sources.txt"
for %f in ("[installdir]\FLC_Tools\java_cup_v11_draw_tree\java_cup\*.java") do echo "%f" >> "C:\Program Files (x86)\FLC_Tools\java_cup_v11_draw_tree\sources.txt"
for %f in ("[installdir]\FLC_Tools\java_cup_v11_draw_tree\java_cup\runtime\*.java") do echo "%f" >> "[installdir]\FLC_Tools\java_cup_v11_draw_tree\sources.txt"
cmd.exe /v:on
for /f "usebackq tokens=*" %l in ("[installdir]\FLC_Tools\java_cup_v11_draw_tree\sources.txt") do (set t=%l & echo !t:\=\\! >> "[installdir]\FLC_Tools\java_cup_v11_draw_tree\sources_dbs.txt")
javac @"[installdir]\FLC_Tools\java_cup_v11_draw_tree\sources_dbs.txt"
del "[installdir]\FLC_Tools\java_cup_v11_draw_tree\sources.txt" "[installdir]\FLC_Tools\java_cup_v11_draw_tree\sources_dbs.txt"

4. Create an environment variable called JFLEX_HOME, with value [installdir]\FLC_Tools\jflex-1.8.1 (replacing [installdir] appropriately).

5. Add to the Path environment variable the values [installdir]\FLC_Tools\jflex-1.8.1\bin and [installdir]\FLC_Tools\java_cup_v11_draw_tree\java_cup.

6. Add to the CLASSPATH environment variable (or create it if it does not exist already) the value [installdir]\FLC_Tools\java_cup_v11_draw_tree, appropriately separating it (using the ; symbol) from any preexisting values.

7. Change the FLC_Tools folder privileges and give the Users full control. To do that, right click on the FLC_Tools folder and click Properties. In the new window, move to the Security tab and click the Edit button next to “To change permissions, click Edit”. Select the Users group and click on Full control under Allow. Then Apply, OK, and then again OK.

Check installation

To verify that the programs have been installed correctly, open a command prompt (cmd) and enter:

jflex

A graphical window should be opened.

For CUP you can type into the command prompt:

java java_cup.Main

and if it is correctly installed you see nothing in the terminal. To stop it you can press CTRL-c.

The installed CUP version contains also the functionality to draw into the screen the parse tree (this version was made especially for this course). To check this part you can type into the command prompt:

java java_cup.MainDrawTree

and if it is correctly installed you see nothing in the terminal. To stop it you can press CTRL-c.


If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/compilers/install_windows
/web/htdocs/www.skenz.it/home/data/pages/compilers/install_windows.txt · Last modified: 2020/05/25 11:33 by emanuele

Privacy Policy