This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes Why doesn't this code work in Netbeans 7.0? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Why doesn Watch "Why doesn New topic
Author

Why doesn't this code work in Netbeans 7.0?

Michael Kenning
Greenhorn

Joined: Apr 16, 2010
Posts: 3

When I run the following code which I got from Head First Java (it uses Java 5.0, by the way), I get the following error:
run:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Accum.getAccum
at ThreadOne.<init>(TestThreads.java:27)
at TestThreads.main(TestThreads.java:18)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)

Here is the code:



Can anybody help me with this problem? I have marked the problem lines, by the way.
Andrey Kozhanov
Ranch Hand

Joined: Mar 12, 2010
Posts: 79
Errors are at lines 64 and 79. They both are , but should be
Michael Kenning
Greenhorn

Joined: Apr 16, 2010
Posts: 3

Andrey Kozhanov wrote:Errors are at lines 64 and 79. They both are , but should be


Thanks! That helped a lot! But now I am getting the following error:

run:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Accum.getAccum
at ThreadOne.<init>(TestThreads.java:27)
at TestThreads.main(TestThreads.java:18)
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)

What does "Erroneous sym type" mean?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

No idea. After fixing those two catch errors the code compiles just fine on my system (Windows 7, JDK 1.6.0_25). The results are random though, but that makes sense since there is no synchronization on the updating of the counter.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
agilemanoj kumar
Ranch Hand

Joined: Mar 07, 2008
Posts: 70
No exceptions/errors found. I tried on windows xp with jdk 1.6


Manoj Kumar
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why doesn't this code work in Netbeans 7.0?
 
Similar Threads
TestThreads Code Magnets exercise Head First Java
How to retrieve data from Annotation type?
Use of Private Constructor in Thread Example
The static synchronized methods of the same class always block each other as only one lock per class
Threads/Looping: How Can This Be?