Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8537129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:49:26+00:00 2026-06-11T10:49:26+00:00

I am currently teaching myself ANTLR and while working through the The Definitive ANTLR

  • 0

I am currently teaching myself ANTLR and while working through the “The Definitive ANTLR Reference” book, I encountered a problem. I am doing the first example and have created the grammar file, got my Lexer and Parser Java files, created the following Java program to test it all:

import org.antlr.runtime.*;

public class Test 
{
    public static void main(String[] args) throws Exception
    {
        ANTLRInputStream input = new ANTLRInputStream(System.in);

        TLexer lexer = new TLexer(input);

        CommonTokenStream tokens = new CommonTokenStream(lexer);

        TParser parser = new TParser(tokens);

        parser.r();
    }
}

I have then used the command line to compile which works fine, then I try and run the Java class and it fails, the whole command line is shown below:

C:\Users\Dan\workspace\Test\src>dir
 Volume in drive C is Acer
 Volume Serial Number is ECB2-5E39

 Directory of C:\Users\Dan\workspace\Test\src

17/09/2012  18:15    <DIR>          .
17/09/2012  18:15    <DIR>          ..
17/09/2012  18:32               723 Test.class
16/09/2012  20:51               353 Test.java
17/09/2012  18:32             3,641 TLexer.class
15/09/2012  21:35             7,625 TLexer.java
17/09/2012  18:32             2,425 TParser.class
15/09/2012  21:35             2,115 TParser.java
               6 File(s)         16,882 bytes
               2 Dir(s)  235,276,161,024 bytes free

C:\Users\Dan\workspace\Test\src>javac -cp C:\antlr-3.4.jar TLexer.java TParser.j
ava Test.java

C:\Users\Dan\workspace\Test\src>java -cp C:\antlr-3.4.jar Test
Error: Could not find or load main class Test

C:\Users\Dan\workspace\Test\src>

I have looked a many solutions and none seem to work for me. The following are fine:

  • JDK and JRE fully up to date
  • PATH has been set
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:49:27+00:00Added an answer on June 11, 2026 at 10:49 am

    Add the current location to the classpath:

    java -cp C:\antlr-3.4.jar;. Test
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently teaching myself Python and was just wondering (In reference to my example
I'm currently teaching myself objective C. I've gone through the tutorials, but I find
I am currently teaching myself iPhone programming and working on solving assignment 2 [PDF]
I am busy teaching myself FXML. I'm doing this by following this example. It's
I've been teaching myself functional programming, and I'm currently writing different higher order functions
I'm currently working on a self-teaching exercise in programming in C# to make an
Hey all, I'm currently teaching myself Objective C and I'm kind of stuck. I'm
I'm interested in teaching myself different data structures, something I currently know very little
I'm currently teaching myself python (coming from no programming background, but a lot of
I am currently teaching myself linear algebra in games and I almost feel ready

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.