exception occured in java compiler

Posted by user2892977 on Stack Overflow See other posts from Stack Overflow or by user2892977
Published on 2013-10-18T03:51:38Z Indexed on 2013/10/18 3:53 UTC
Read the original article Hit count: 532

Filed under:

I am a beginner in Java.I have JDK1.7.0 installed on windows 7 OS.I just wrote a sample java file where the file was not getting compiled and throws the below error.

Sam.java:5: ';' expected
                Sample p = New Sample();
                                            An exception has occurred in the compile
        r (1.7.0-ea). Please file a bug at the Java Developer Connection (http://java.su
        n.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include
        your program and the following diagnostic in your report.  Thank you.
        java.lang.StringIndexOutOfBoundsException: String index out of range: 26


     at java.lang.String.charAt(String.java:694)
        at com.sun.tools.javac.util.Log.printErrLine(Log.java:251)
        at com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:343)
        at com.sun.tools.javac.util.Log.report(Log.java:315)
        at com.sun.tools.javac.util.AbstractLog.error(AbstractLog.java:96)
        at com.sun.tools.javac.parser.Parser.reportSyntaxError(Parser.java:295)
        at com.sun.tools.javac.parser.Parser.accept(Parser.java:326)
        at com.sun.tools.javac.parser.Parser.blockStatements(Parser.java:1599)
        at com.sun.tools.javac.parser.Parser.block(Parser.java:1500)
        at com.sun.tools.javac.parser.Parser.block(Parser.java:1514)
        at com.sun.tools.javac.parser.Parser.methodDeclaratorRest(Parser.java:25
69)
        at com.sun.tools.javac.parser.Parser.classOrInterfaceBodyDeclaration(Par
ser.java:2518)
        at com.sun.tools.javac.parser.Parser.classOrInterfaceBody(Parser.java:24
45)
        at com.sun.tools.javac.parser.Parser.classDeclaration(Parser.java:2290)
        at com.sun.tools.javac.parser.Parser.classOrInterfaceOrEnumDeclaration(P
arser.java:2228)
        at com.sun.tools.javac.parser.Parser.typeDeclaration(Parser.java:2217)
        at com.sun.tools.javac.parser.Parser.compilationUnit(Parser.java:2163)
        at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:530)
        at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:571)
        at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:82
2)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:748)
        at com.sun.tools.javac.main.Main.compile(Main.java:386)
        at com.sun.tools.javac.main.Main.compile(Main.java:312)
        at com.sun.tools.javac.main.Main.compile(Main.java:303)
        at com.sun.tools.javac.Main.compile(Main.java:82)

        at com.sun.tools.javac.Main.main(Main.java:67)

Below is the code for Sam.java file

class sam
{
    public static void main(String args[])

    {
    Sample p = New Sample();

    p.show();
    p.display();


    }
}

I researched in google with the various compiler options but that did not help.I would like to understand the below errors. 1 - Sam.java:5: ';' expected 2 - An exception has occurred in the compiler (1.7.0-ea)

© Stack Overflow or respective owner

Related posts about java