JavaCC

  • Katushai
  • Graduate
  • Graduate
  • User avatar
  • Posts: 152

Post 3+ Months Ago

hey, i have a question about this java compiler i installed on Gentoo recently, called JavaCC. i tried compiling a simple java program:

Code: [ Select ]
import java.awt.*;

public class JavaTest {
  public JavaTest() {
    System.out.println("\n\n\n\nTesting!\n\n\n");
  }

  public static void main(String argv[]) {
    JavaTest testclass = new JavaTest();
  }
}
  1. import java.awt.*;
  2. public class JavaTest {
  3.   public JavaTest() {
  4.     System.out.println("\n\n\n\nTesting!\n\n\n");
  5.   }
  6.   public static void main(String argv[]) {
  7.     JavaTest testclass = new JavaTest();
  8.   }
  9. }


But when i go to compile it, like so:

Code: [ Select ]
Java Compiler Compiler Version 3.2 (Parser Generator)
(type "javacc" with no arguments for help)
Reading from file JavaTest.java . . .
org.javacc.parser.ParseException: Encountered "import" at line 1, column 1.
Was expecting one of:
  "options" ...
  "PARSER_BEGIN" ...

Detected 1 errors and 0 warnings.
  1. Java Compiler Compiler Version 3.2 (Parser Generator)
  2. (type "javacc" with no arguments for help)
  3. Reading from file JavaTest.java . . .
  4. org.javacc.parser.ParseException: Encountered "import" at line 1, column 1.
  5. Was expecting one of:
  6.   "options" ...
  7.   "PARSER_BEGIN" ...
  8. Detected 1 errors and 0 warnings.


obviously, the problem is something to do with the options, so i played with the options. it didnt help, still the same problems. I wasnt sure if i should post this in the linux forum or the programming forum, but i figured the linux people would be able to handle it better. move it if you wish, it doesnt matter to me.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • PsyckBoy
  • Graduate
  • Graduate
  • PsyckBoy
  • Posts: 204
  • Loc: SoCal

Post 3+ Months Ago

Description of JavaCC from it's homepage:
Quote:
Java Compiler Compiler (JavaCC) is the most popular parser generator for use with Java applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.


Simply put, JavaCC will not compile Java source code. It converts special "grammar" files into Java source code. You need to find an actual Java compiler.
  • AnarchY SI
  • Web Master
  • Web Master
  • User avatar
  • Posts: 2521
  • Loc: /usr/src/MI

Post 3+ Months Ago

such as the one that comes w/the java sdk ;)

http://java.sun.com


although you may find it in portage somewhere..
  • Katushai
  • Graduate
  • Graduate
  • User avatar
  • Posts: 152

Post 3+ Months Ago

thanks, appreciate it alot
  • AnarchY SI
  • Web Master
  • Web Master
  • User avatar
  • Posts: 2521
  • Loc: /usr/src/MI

Post 3+ Months Ago

no problemo :]

just post if you need anything else.

Post Information

  • Total Posts in this topic: 5 posts
  • Users browsing this forum: No registered users and 21 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.