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

  • SEARCH
  • Home
  • 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 8007353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:47:49+00:00 2026-06-04T17:47:49+00:00

I am getting the following exception Exception in thread AWT-EventQueue-0 java.lang.NullPointerException at Java.CompileFile.doCompilation(CompileFile.java:48) at

  • 0

I am getting the following exception

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Java.CompileFile.doCompilation(CompileFile.java:48)
at GUI.CompilerForm.compileBtnActionPerformed(CompilerForm.java:225)
at GUI.CompilerForm.access$400(CompilerForm.java:23)
............

I no the error is at line 48 in CompileFile.java, it is saying that the array in NULL and i dont know why because that is where i am adding strings to it!

String[] compile;
int numberOfErrors = 0;
.
.
.
 for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {                
            String errors = diagnostic.getKind().toString()+" on line  "+ diagnostic.getLineNumber() +"\nIn file:  \n"+ diagnostic.toString();
            compile[numberOfErrors] = errors;
            numberOfErrors++;
        }

I have tried System.out.println(errors); straight after i set it and it is working fine so i really dont know what is going on!

Any suggestions?

  • 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-04T17:47:51+00:00Added an answer on June 4, 2026 at 5:47 pm

    You’ve declared a variable called compile, but you haven’t shown anywhere that it’s given a value. Assuming it’s an instance variable, its value will default to null. You need to initialize it with:

    compile = new String[someSize];
    

    where someSize is “big enough”.

    Alternatively, and preferrably, you could use a list:

    // TODO: Rename variable to something more sensible
    private final List<String> compile = new ArrayList<String>();
    

    then…

    compile.add(errors);
    

    Then you can probably get rid of numberOfErrors too, as that would just be compile.size() presumably.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting the following NullPointerException: Exception in thread AWT-EventQueue-0 java.lang.NullPointerException at com.foo.JawsFileChooser.a(SourceFile:28) at com.foo.JawsFileChooser$1.actionPerformed(SourceFile:91)
I am getting something like the following: Exception in thread main java.lang.UnsatisfiedLinkError: no viewerNativeDLL
I am getting the following exception when running an applet: Exception in thread AWT-EventQueue-4
I'm getting the following error message : Exception in thread main java.lang.NoClassDefFoundError: LU62XnsCvr (wrong
I am getting the following error Exception in thread main java.lang.ClassCastException: org.hibernate.impl.SessionFactoryImpl cannot be
I am getting the following exception: Exception in thread main java.lang.ClassCastException: javax.crypto.CipherInputStream cannot be
I'm getting the following error: Exception in thread main java.lang.IndexOutOfBoundsException: Index: 86, Size: 86
I'm getting the following errors: Exception in thread main java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:810) at java.util.HashMap$KeyIterator.next(HashMap.java:845)
I'm getting the following exception on startup with Dropwizard Exception in thread main javax.validation.ValidationException:
I am getting following exception for one of my Jasper Reports. The part of

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.