Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: package org.antlr.v4.runtime does not exist

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default package org.antlr.v4.runtime does not exist

    This is my code :

    import java.io.*;
    import java.util.*;
    import org.antlr.v4.runtime.*;
    import org.antlr.v4.runtime.tree.*;

    class Lexicon {

    public static Trie<List<Entry>> load() throws IOException, ParseError {
    ANTLRInputStream input = new ANTLRInputStream(new InputStreamReader(
    Main.class.getResourceAsStream("/lexicon.txt"), "UTF-8"));
    LexiconLexer lexer = new LexiconLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    LexiconParser parser = new LexiconParser(tokens);
    LexiconParser.ListContext list = parser.expr().list();
    Entry[] entries = new Entry[list.item().size()];
    int i = 0;

    And I got this error :

    package org.antlr.v4.runtime does not exist
    package org.antlr.v4.runtime.tress does not exist
    cannot find symbol class ANTLRInputStream
    cannot find symbol class Main
    cannot find symbol class LexiconLexer
    cannot find symbol class CommonTokenStream
    cannot find symbol class LexiconParser
    package LexiconParser does not exist

    Can someone help me? Thank You
    Last edited by aisyah; April 25th, 2019 at 07:37 PM.

  2. #2
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: package org.antlr.v4.runtime does not exist

    ANTLR is not included in the Java API. it is a separate capability and library that needs to be downloaded and referenced to use.

    Regards,
    Jim

  3. #3
    Junior Member
    Join Date
    Apr 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: package org.antlr.v4.runtime does not exist

    I already download ANTLR file (antlr-runtime-4.0.jar) on windows 10. How's to install jar file on windows?
    Last edited by aisyah; April 25th, 2019 at 08:02 PM.

  4. #4
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: package org.antlr.v4.runtime does not exist

    How are you compiling your code? And IDE, command prompt using javac?

    Regards,
    Jim

  5. #5
    Junior Member
    Join Date
    Apr 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: package org.antlr.v4.runtime does not exist

    I'm using JCreator LE for compiling code.

  6. #6
    Member
    Join Date
    Sep 2018
    Location
    Virginia
    Posts
    284
    My Mood
    Cool
    Thanks
    0
    Thanked 38 Times in 36 Posts

    Default Re: package org.antlr.v4.runtime does not exist

    Unfortunately, I am not familiar with that IDE. I recommend you do a web search on how to add libraries to JCreator.

    Regards,
    Jim

  7. #7
    Junior Member
    Join Date
    Apr 2019
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: package org.antlr.v4.runtime does not exist

    Thank you Jim for your help.

Similar Threads

  1. JDK11 package does not exist
    By Dayblox in forum Java IDEs
    Replies: 0
    Last Post: October 1st, 2018, 05:26 PM
  2. Package x does not exist????
    By big10p in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 23rd, 2013, 06:11 AM
  3. Package does not exist
    By AceX in forum Java Theory & Questions
    Replies: 5
    Last Post: February 22nd, 2013, 04:11 PM
  4. Simple package problem, package does not exist error
    By Farmer in forum Object Oriented Programming
    Replies: 3
    Last Post: August 23rd, 2011, 11:18 AM
  5. org.apache.derby does not exist?
    By disclaimer in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 30th, 2010, 04:58 PM