Path: csiph.com!aioe.org!bofh.it!news.nic.it!robomod From: raphael.jolly@free.fr Newsgroups: linux.debian.maint.java Subject: Re: javac - error: package org.antlr.v4.runtime does not exist Date: Thu, 09 Jul 2020 10:50:01 +0200 Message-ID: References: X-Original-To: Sam Kuper X-Mailbox-Line: From debian-java-request@lists.debian.org Thu Jul 9 08:44:04 2020 Old-Return-Path: X-Amavis-Spam-Status: No, score=-5.599 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, FOURLA=0.1, FREEMAIL_FROM=0.001, LDO_WHITELIST=-5, RCVD_IN_DNSWL_LOW=-0.7, THREADTOPIC=2] autolearn=no autolearn_force=no X-Policyd-Weight: using cached result; rate: -5.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [37.165.246.134] X-Mailer: Zimbra 8.8.7_GA_1002 (ZimbraWebClient - FF78 (Win)/8.8.7_GA_1002) Thread-Topic: javac - error: package org.antlr.v4.runtime does not exist Thread-Index: yANSR/KS6OHdT9vdxilWAs8AYdgqFQ== X-Mailing-List: archive/latest/22340 List-ID: List-URL: List-Archive: https://lists.debian.org/msgid-search/1671660942.1515347656.1594284226046.JavaMail.zimbra@free.fr Approved: robomod@news.nic.it Lines: 104 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Cc: ML debian-java X-Original-Date: Thu, 9 Jul 2020 10:43:46 +0200 (CEST) X-Original-Message-ID: <1671660942.1515347656.1594284226046.JavaMail.zimbra@free.fr> X-Original-References: <20200709001910.jvfmlungaoiim43p@posteo.net> Xref: csiph.com linux.debian.maint.java:11754 javac -cp $CLASSPATH Xi*.java maybe ? Raphael ----- Mail original ----- De: "Sam Kuper" =C3=80: "ML debian-java" Envoy=C3=A9: Jeudi 9 Juillet 2020 02:19:10 Objet: javac - error: package org.antlr.v4.runtime does not exist Dear all, I apologise in advance for asking what might be an ignorant question, but it has been ages since I used Java for anything and so my Java troubleshooting skills are currently rusty/nonexistent. On a box running Debian Stretch (oldstable), I am trying to compile an Antlr4 lexer & parser. The first step (generating the lexer & parser .java files from .g4 files) works fine, but the second step (compiling the the lexer & parser) does not. Here's the first step: $ mkdir /tmp/antlr-test $ cd $_ $ wget --page-requisites --recursive --level=3Dinf --convert-links \ --no-parent \ https://www.cs.cornell.edu/courses/cs4120/2013fa/handouts/antlr.html $ cd www.cs.cornell.edu/courses/cs4120/2013fa/handouts/xi $ ls -1 hello.xi XiLexer.g4 XiParser.g4 $ antlr4 XiLexer.g4 XiParser.g4 -no-listener ; echo $? 0 $ ls -1 hello.xi XiLexer.g4 XiLexer.java XiLexer.tokens XiParser.g4 XiParser.java XiParser.tokens All fine so far, as you can see. Now the second step: $ javac Xi*.java XiLexer.java:2: error: package org.antlr.v4.runtime does not exist import org.antlr.v4.runtime.Lexer; ^ [SNIP - for full output, see attached file.] 100 errors Oh dear. What to do? The [Antlr4 FAQ](https://github.com/antlr/antlr4/blob/master/doc/faq/installation.md_ says, "If you see these kinds of errors, it's because you don't have the runtime or complete ANTLR library in your CLASSPATH." I installed Antlr4 via `sudo apt install antlr4` and I installed javac via `sudo apt install default-jdk` so I would hope that Antlr4 is reachable by javac, but in case not, I tried manually populating the CLASSPATH environment variable with the same contents found in the antlr4 executable, before running javac again: $ cat /usr/bin/antlr4 #!/bin/sh CLASSPATH=3D/usr/share/java/stringtemplate4.jar:/usr/share/java/antlr4.= jar:/usr/share/java/antlr4-runtime.jar:/usr/share/java/antlr3-runtime.jar/:= /usr/share/java/treelayout.jar exec java -cp $CLASSPATH org.antlr.v4.Tool "$@" $ CLASSPATH=3D'.' $ CLASSPATH+=3D':/usr/share/java/stringtemplate4.jar' $ CLASSPATH+=3D':/usr/share/java/antlr4.jar' $ CLASSPATH+=3D':/usr/share/java/antlr4-runtime.jar' $ CLASSPATH+=3D':/usr/share/java/antlr3-runtime.jar/' $ CLASSPATH+=3D':/usr/share/java/treelayout.jar"; javac Xi*.java XiLexer.java:2: error: package org.antlr.v4.runtime does not exist import org.antlr.v4.runtime.Lexer; ^ [SNIP - for full output, see attached file.] 100 errors No improvement :( So my question is: how can I make the `javac Xi*.java` command succeed, *without* having to fall back on a non-Debian-provided Antlr4 installation? (Two examples of non-Debian-provided Antlr4 installation would be: a .jar produced by me cloning and building https://github.com/antlr/antlr4; or if I downloaded this .jar: https://www.antlr.org/download/antlr-4.7.1-complete.jar ). Thanks in advance for any help you can provide! Sam --=20 A: When it messes up the order in which people normally read text. Q: When is top-posting a bad thing? () ASCII ribbon campaign. Please avoid HTML emails & proprietary /\ file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.