• 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

Problem with my Java

 
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey everyone,

I asked a question a couple of days ago about the BeatBox program from the Head First Java 2nd Ed book.

my program was fine, but it would not compile.

I emailed Bert bates, as he has helped me in the past, I got a reply.

He said that I should ask here if someone knows any tricks to get this fixed, other than a complete re-install of my java.

he gave me a program to test, this is the code:

expected output:


here is my compiler error:

StaticTest java:7: cannot find symbol
Symbol: constructor Box(int)
Location: class Box
Box b = new Box(BoxLayout.Y_AXIS);
1 error

is there a fix, or would I have to re-install java?

Davy
[ November 26, 2006: Message edited by: Davy Kelly ]
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Compiles and run fine here...

BTW, what version of Java are you using? What is the output when you run "java -version"?

Henry
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey,

version is:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM)Client VM (build 1.5.0_06-b05, mixed node, sharing)

that is what it says from my command prompt.

I have in my Java Folder 4 folders:
JDK 1.5.0_03
JRE 1.5.0_03
JRE 1.5.0_04
JRE 1.5.0_06

My java programs get stored in JDK 1.5.0_03 and when compiling I have the command line set at:
C:\program files\Java\jdk1.5.0_03>

davy
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've created, someplace, your own class named "Box", and there's either a "Box.class" or "Box.java" (or both) laying about. The Java compiler thinks you're referring to your own "Box" class, when in fact you're intending to refer to the Box Swing component here. Carefully delete any copies of Box.java and/or Box.class -- unless they're essential to your project, in which case you'll need to change the example program a little.
 
Davy Kelly
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ernest you are the man,

thank you, I got rid of the class Box yesterday but I never got ris of the Box.java file. thanks you, that has helped me.

I wish there was reputation points here, you would get a bundle.

davy
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Davy Kelly:

I wish there was reputation points here, you would get a bundle.



Kind thank-yous are the best reward!
 
Look! It's Leonardo da Vinci! And he brought a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic