0

Viewing the file in NetBeans, it indicates that it has an error, but doesn't say what. When I accessed the constant from another class, it gives an Uncompilable Source Code RuntimeException.

The file below is changed from the original only in that the package, class, and variable names are changed, and the original array has about 200x100 integers

package javaapplication;
class Constants
{
    static final int[][] MAP = 
    {{1, 2, 3 },
     {2, 3, 4 },
     {4, 9, 0 },
     {2, 3, 4 }};
}  

I tried to isolate the problem, by starting with an array of 3 rows of 181 0's. I added one row at a time, without any errors, until I added the 69th row (exactly like all the others). Then, NetBeans indicated an error parsing the file.
Is there a limit of about 38,000 characters?

Ypnypn
  • 933
  • 1
  • 8
  • 21
  • 1
    Works for me. :-/ Does your program work if you substitute this file for the one triggering the error? – BRPocock Dec 31 '13 at 02:06
  • 3
    _"When I accessed the constant from another class,"_ can you show us how you do it? – Baby Dec 31 '13 at 02:07
  • Can you try to compile the java code in console, instead of using NetBeans? If it works in console, then this is a NetBeans configuration issue. – shaochuancs Dec 31 '13 at 02:22
  • Your sample also works for me with NetBeans 7.4. Since your failing code has a fairly large array I suggest that you comment out almost all of its initialized content, then progressively add rows back in until you get an error. Perhaps you have some unexpected character(s) in your array definition that is causing the problem (though NetBeans gives me very explicit compilation error messages when I try that approach). – skomisa Dec 31 '13 at 02:36

1 Answers1

1

try to uncheck "Compile on save" setting in the project properties (Build -> Compiling).

sasankad
  • 3,543
  • 3
  • 24
  • 31
  • I don't think this will solve the problem. Close the auto-compile just delay the compile, sooner or later the code will be built and run. – shaochuancs Dec 31 '13 at 02:28
  • @cshao, it might solve it as there's related bug reported in Netbeans, https://netbeans.org/bugzilla/show_bug.cgi?id=182009 – sasankad Dec 31 '13 at 02:34
  • Ah, it seems an issue in NetBeans. I also found a possible duplicate in StackOverflow: http://stackoverflow.com/questions/4386076/uncompilable-source-code-runtimeexception-in-netbeans?rq=1 Thanks sasankad. Voted. – shaochuancs Dec 31 '13 at 03:01