User Tools

Site Tools

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.


The Oracle JDK can be downloaded at the following address, 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.

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.2 (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.2 (where [installdir] is the path you chose in step 1).

3. Open a command prompt with administrator privileges and execute:

cd [installdir]\FLC_Tools\java_cup_v11_draw_tree\java_cup
javac *.java runtime\*.java ..\

4. Go to control Settings → System → About → System Info → advanced system settings, or BETTER search for “environment variables” and click on “Edit the system environment variables”. Then go to Environment Variable.

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

5. Add to the Path environment variable the values [installdir]\FLC_Tools\jflex-1.8.2\bin and [installdir]\FLC_Tools\java_cup_v11_draw_tree\java_cup;. (remember the dot .).

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;. (remember the dot .), 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:


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.

Complete Check of installation

  1. Download the following code:
  2. Decompress in a directory end type in a terminal the following commands
jflex scanner.jflex
java java_cup.MainDrawTree parser.cup
javac *.java
java Main example_expr.txt

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.

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

You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url:
/web/htdocs/ · Last modified: 2024/04/08 22:34 by

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki
Privacy Policy