• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error in FileReader

 
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Here I am trying to read a text file using java. But when I try to compile that, I am getting the error "Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol". This error is coming from line number 173, from "FileReader". Here is my code



Please help
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help me....
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try doing a full rebuild from your IDE. I copy-pasted your code and without modifying it, it compiled just fine.

Now, how did I know you're using an IDE? Because you can't run uncompiled code from the command line. IDE's like Eclipse allow you to run uncompilable code, but in 99% of the cases it won't run. That's why I give the following advice most times I see this problem occur: always fix all your compiler errors before running any application.

Oh, and

Yohan Weerasinghe wrote:Please help me....


PatienceIsAVirtue.
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I googled your error and many of the items returned referred to NetBeans. Is that what you are using? One of them said try a build clean.

BTW, you have a bug at line 184. Do you see it?
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all of your replies. It is not compiling fine in command line....This is the whole error I am getting using NetBeans


run:
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: constructor FileReader(java.lang.String)
location: class FileReader
at musicOnWeb$forTime.actionPerformed(musicOnWeb.java:172)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
BUILD SUCCESSFUL (total time: 5 seconds)

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, that compile fine in CMD. I had some kind of error in JAVA installation or something. After restarting the machine, it worked fine in cmd as the Moderator said. But it still giving errors in NetBeans.

here is the error

run:
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - cannot find symbol
symbol: constructor FileReader(java.lang.String)
location: class FileReader
at musicOnWeb$forTime.actionPerformed(musicOnWeb.java:172)
at javax.swing.Timer.fireActionPerformed(Timer.java:271)
at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
BUILD SUCCESSFUL (total time: 6 seconds)


Apart from that, when I run that in CMD, It is giving the output for each and every second!


 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help me please
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally, solved. That is netbeans, not me!!! Anyway, having this error in netbeans is really annoying. How could I solve that?
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you already done a full rebuild as I already suggested 4 hours ago?

Yohan Weerasinghe wrote:Help me please


I already posted the PatienceIsAVirtue FAQ entry after a one-hour bump. Do you really think that a 15-minutes bump is not getting the same response?
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:Have you already done a full rebuild as I already suggested 4 hours ago?





I am not good in IDE's. I use IDE just for good alignments and for easy error handling and that's it. I have one project called "project1" and all the java files related to different different programs are there. What I did is this " RUN > Clean and Build. I hope I didn't do the correct thing, because it didn't solve the matter.

I already posted the PatienceIsAVirtue FAQ entry after a one-hour bump. Do you really think that a 15-minutes bump is not getting the same response?


Sorry for that. Yesterday my head was like a crow nest, because you said that is working fine, in my case netbeans shows errors, CMD shows "FileNotFound" .....I had to replace the file into another location then only it worked fine in CMD
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have opened a seperate project called "musicOnWeb". This works completely fine in there. Thanks all of you for your help. I really appreciate all of your help. Thanks again. Marking this thread as solved...

PS: I need to ask a question about this web site. In which section I could post my question?
 
Rob Spoor
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use the Ranch Office forum for that.
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:Use the Ranch Office forum for that.



Thank you...
 
No holds barred. And no bars holed. Except this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic