Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The version of the java executable should actually be checked #3

Open
kaby76 opened this issue Aug 24, 2022 · 11 comments
Open

The version of the java executable should actually be checked #3

kaby76 opened this issue Aug 24, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@kaby76
Copy link

kaby76 commented Aug 24, 2022

  • This code "tests" the version of java, but it's false, so it never gets checked.
  • Over here in Antlr4BuildTasks, I don't check the version of java, but I need to because some versions of java don't work, e.g., version 7. Even a quick "java --version" would have found that v7 of java doesn't work because there's no "--version" option.
  • The Antlr tool jar has a minimum requirement of version 11 or newer.
  • The "Quick Start" instructions over on antlr.org should stop defining the alias "alias antlr4='java -jar /usr/local/lib/antlr-4.10.1-complete.jar'" and just point to set up the tools from this repo. The tool here is much better because it could check the version of java, and download a version that can work if one tries to use the wrong version.
@parrt
Copy link
Member

parrt commented Aug 27, 2022

hi! Yep, I can't remember but I believe that I had that CHECK_JRE_VERSION in there for debugging.

I think I point out that it requires 11 for the tool but I don't enforce it. I probably should.

I agree about the Quickstart instructions. I left a snarky comment about Windows installation not updating the path in antlr4-tools README since I wasted an hour trying to get it to work. Can you give me instructions how to just pip install these tools and type antlr4 to have it work? I tried DOS and powershell. The scripts get placed in some unbelievably mysteriously deep path and I just don't understand why software would be so ignorant as to not update the path so I could run the code.

@parrt parrt added the enhancement New feature or request label Aug 27, 2022
@kaby76
Copy link
Author

kaby76 commented Aug 27, 2022

Strange, I got the instructions from the tool page, and it just works on Windows--albeit in MSYS64.

$ pip uninstall antlr4-tools
Found existing installation: antlr4-tools 0.1
Uninstalling antlr4-tools-0.1:
  Would remove:
    c:\users\kenne\appdata\local\programs\python\python310\lib\site-packages\antlr4_tool_runner.py
    c:\users\kenne\appdata\local\programs\python\python310\lib\site-packages\antlr4_tools-0.1-py3.10.egg-info
    c:\users\kenne\appdata\local\programs\python\python310\scripts\antlr4-parse-script.py
    c:\users\kenne\appdata\local\programs\python\python310\scripts\antlr4-parse.exe
    c:\users\kenne\appdata\local\programs\python\python310\scripts\antlr4-script.py
    c:\users\kenne\appdata\local\programs\python\python310\scripts\antlr4.exe
Proceed (Y/n)?
  Successfully uninstalled antlr4-tools-0.1

Kenne@DESKTOP-DL44R7B MINGW64 /c/Users/Kenne/Documents/GitHub/Domemtech.Trash/_tests/piggy
$ antlr4
bash: antlr4: command not found

Kenne@DESKTOP-DL44R7B MINGW64 /c/Users/Kenne/Documents/GitHub/Domemtech.Trash/_tests/piggy
$ pip install antlr4-tools
Collecting antlr4-tools
  Using cached antlr4-tools-0.1.tar.gz (3.4 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: install-jdk in c:\users\kenne\appdata\local\programs\python\python310\lib\site-packages (from antlr4-tools) (0.3.0)
Using legacy 'setup.py install' for antlr4-tools, since package 'wheel' is not installed.
Installing collected packages: antlr4-tools
  Running setup.py install for antlr4-tools ... done
Successfully installed antlr4-tools-0.1
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the 'C:\Users\Kenne\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.

Kenne@DESKTOP-DL44R7B MINGW64 /c/Users/Kenne/Documents/GitHub/Domemtech.Trash/_tests/piggy
$ which antlr4
/C/Users/Kenne/AppData/Local/Programs/Python/Python310/Scripts/antlr4

I don't recall if I manually had to set up PATH. I have another machine, and I check all this there.

Java 11 is the minimum stated here.

@parrt
Copy link
Member

parrt commented Aug 27, 2022

Thanks for checking. Maybe it's the version of windows or that you had already put it in the path I guess? Please do check on another machine if you have one. I will try again after a reboot of my windows box.

@parrt
Copy link
Member

parrt commented Aug 27, 2022

also, DOS and powershell say which doesn't exist. Are you running a unix shell in that mingw thingie?

@kaby76
Copy link
Author

kaby76 commented Aug 27, 2022

Of course, I'm running a Bash shell! No one with intelligence would use DOS Cmd or Powershell--unless forced to. But, I'll check those.

@parrt
Copy link
Member

parrt commented Aug 27, 2022

omg. agreed. those users should be punished.

@parrt
Copy link
Member

parrt commented Sep 11, 2022

@kaby76 Any luck with a DOS or powershell command to support the python scripts ...\local-packages\python38\scripts added to PATH?

@parrt
Copy link
Member

parrt commented Sep 11, 2022

I updated the antlr getting started documentation to use this tool set: https://github.com/antlr/antlr4/blob/master/doc/getting-started.md

@kaby76
Copy link
Author

kaby76 commented Sep 11, 2022

For Windows:

  • Go to the Microsoft Store
  • Search in Microsoft Store for Python
  • Select the newest version of Python (3.10).
  • Click the "Get" button. Store installs python and pip at "c:\Users...\AppData\Local\Microsoft\WindowsApps\python.exe" and "c:\Users...\AppData\Local\Microsoft\WindowsApps\pip.exe", respectively. And, it updates the search path immediately with the install.
  • Open a "cmd" terminal.
  • You can now type "python" and "pip", and "pip install antlr4-tools". Unfortunately, it does not add that to the search path.
  • Update the search path to contain "c:\Users...\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p8\LocalCache\local-packages\Python310\Scripts". You may need to install MSYS2, then do a "find /c/ -name antlr4.exe 2> /dev/null" and enter that path.
  • Or, you can set up an alias to antlr4.exe on that path.
  • The good news is that the Antlr4 Python tool downloads the Antlr .jar in a standard location, and you don't need to do that manually.
  • It's also possible to go in a browser, go to python.org, and download the python package. But, it's likely you will need to update the path for antlr4.exe as before.

@parrt
Copy link
Member

parrt commented Sep 11, 2022

Thanks. I’ll update doc here and antlr

@parrt
Copy link
Member

parrt commented Sep 19, 2022

I still need to change the examples on the main webpage of antlr but I'm wondering if I should do a refresh on the look of the website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants