Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

error in IcecreamCounter program

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hallo everyone  i need help with my program which is supposed to  read the file icecream.dat  , i have put the .dat  file and textIO file in the same location with the program
C:\Users\user\Documents\NetBeansProjects\IcecreamCounter\src\icecreamcounter
and this is my code


im getting this error when i run the program

Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: icecreamcounter.TextIO.readFile
at icecreamcounter.IcecreamCounter.main(IcecreamCounter.java:14)
C:\Users\user\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)


can you please help me to show where i am getting wrong i 'm a beginner  in java
 
Marshal
Posts: 69894
278
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I shall go back and add code tags to your post; you sh‍ould always use the tags. You can see how much better it will look
The exception you are suffering is probably caused by using Eclipse and ignoring its warning not to run the code. Go back to the source code and look for little red marks at the left, and tell us which like the error occurs on. If you hover your mouse on the red mark, you will get a popup box with more details of what the error is.

What is TextIO? It isn't in the java.io package. How do you get an Illegal Argument Exception from it? Why have you not closed the catch with a } before reading the file? Why are you mixing ints and doubles like that. If you have 1000000000 ice‑creams and 999999999 of them are strawberry, when you divide the two ints, what will the percentage of strawberry come out as? Why are you trying to squeeze so much into the main method?

[Edit]I see you are using NetBeans. I didn't know NetBeans allowed you to try uncompilable code, too. But it is the same sort of problem; you need to work out what the compiler error is from the information the IDE gives you. Or stop using an IDE.
 
Master Rancher
Posts: 3883
35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
returning a value in a void method should be a compiler error.
 
Carey Brown
Bartender
Posts: 7208
65
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Norm Radder wrote:returning a value in a void method should be a compiler error.


Good point. Alice, have you tried to compile this?
 
No, tomorrow we rule the world! With this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic