Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: bilsch Newsgroups: comp.lang.java.programmer Subject: Re: my java is broken ! Date: Thu, 03 May 2012 15:03:40 -0700 Organization: A noiseless patient Spider Lines: 112 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 3 May 2012 22:03:42 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="llALXQ6TxsVqIoSLcrwVyA"; logging-data="3331"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IRNsh9CVtHMe5hXrYYaiB" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 In-Reply-To: Cancel-Lock: sha1:PKuKELCplGS7jMV5l2BNVEnSs6Q= Xref: csiph.com comp.lang.java.programmer:14225 On 04/29/2012 04:06 PM, Arved Sandstrom wrote: > On 12-04-29 07:21 PM, bilsch wrote: >> On 04/29/2012 07:25 AM, Joshua Cranmer wrote: >>> On 4/29/2012 7:13 AM, bilsch wrote: >>>> I wrote a loop to read a 26000 character text file NVRAM.TXT into a >>>> character array. It worked fine. The program is listed below. It has >>>> only 24 lines. Today when I run it, it has weird errors referenced to >>>> line numbers 2442, 2685 and 1620. When I click on those error messages >>>> it shows lines in a completely different program - a program that I >>>> never wrote for sure. I saved the file with a different name and it runs >>>> fine with that name - no errors. The file name that has the problem is >>>> Nvj5. That is the file selected and displayed when I click RUN FILE. It >>>> is the file listed below. Even though it is selected and displayed when >>>> I click RUN FILE my system is running some other huge file instead. Has >>>> anyone ever heard of a problem like this? >>> >>> When you refuse to mention error messages, the answer becomes "I have no >>> clue." >>> >>> It would also help to know what the command line is that is causing it. >>> It could be that your IDE is buggy, too (since it sounds like you rely >>> on a specific IDE feature). >>> >> I can't tell you the error messages now because I deleted the offending >> file - so can't generate errors anymore. It seems the error messages >> are irrelevant since they point to lines in some large unknown program. > > Your system is not "running" some other "file", not in the sense that > you think. Your Java source files are compiled into .class files, these > are loaded up into memory as required, and broadly speaking it's the > bytecodes in these class files that get executed ("run"). The first > application code to execute is the proper main() method in your main > class...like Nvj5.main(). Since you are using standard library code > also, like FileInputStream, code in those classes - and in the classes > that FileInputStream uses, and so on and so on - also gets executed. > > That mysterious huge file is a standard library class that your code > needs to work. It's not irrelevant. A high percentage of the time when > you write buggy code the errors start in library code, not in your own > code. You need to look at the entire stack. You will notice that > somewhere in the stack are line references to your own code also. > > You deleted and renamed *which* files exactly? Also, you have a class > Nvj5 but a corresponding source file "Nvj5.java". You'll find that > people understand you better if you differentiate between data files > (like NVRAM.TXT) and source files (like Nvj5.java). > > Are you saying that you renamed class Nvj5 in source file Nvj5.java to > class Pwll12 in source file Pwll12.java, say, and ever since your > program has run like a charm? That seems highly unlikely. In fact that's > astronomically unlikely. > I copied the source from the offending file then I deleted the entire project folder - everything. Then I created a new project and a new blank .java file and pasted the copied source in that new file. I used new names for the new file and folder. Once I did that the source(in the new file) ran without a glitch. I tested it several times over a period of days and it always worked. NOW, TODAY THE NEW FILE HAS GOTTEN THE SAME PROBLEM JUST LIKE THE OLD FILE I have the error information pasted below along with the source, also below. The error lines are in a different file than the one I am running - now named Nvr1.java.. > What IDE or programming text editor are you using? How many "main" > classes are currently available in your workspace? When you tried that > failing run did you see any console output at all? > I am using NetBeans to do exerything. > AHS THE ERROR INFORMATION: run: Exception in thread "main" java.lang.VerifyError: Constructor must call super() or this() before return in method Nvr1.()V at offset 0 at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2442) at java.lang.Class.getMethod0(Class.java:2685) at java.lang.Class.getMethod(Class.java:1620) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:488) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:480) Java Result: 1 BUILD SUCCESSFUL (total time: 4 seconds) THE SOURCE: import java.io.*; public class Nvr1 { public static void main(String[] args){ try { FileInputStream file = new FileInputStream("NVRAM.TXT"); char[] nvchr = new char [30000]; int fin = 1; int count = 1; while (fin != -1) { fin = file.read(); nvchr[count] = (char) fin; System.out.print(nvchr[count]); count++; } System.out.println("Bytes read : " + count); file.close(); } catch (IOException e){ System.out.println("Could not read file"); } } } TIA. Bill S.