Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. A foolish mistake

A foolish mistake

Scheduled Pinned Locked Moved The Lounge
javahelp
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cp Coder
    wrote on last edited by
    #1

    While messing around with Java I made a stupid mistake that took me the better part of the morning to figure out: I gave the project the same name as the name of the main Java class used in the project. You shouldn't do that, I know now, but it had some weird consequences. The main problem was: If I tried to run one of the class's constructors, Java would look for the constructor in the project, not the class! I could not figure out why the compiler kept telling me that the constructor does not exist, while I knew damn well that the class does have such a constructor. :confused: In the end in desperation, I restarted the project under a different name. Problem solved! This is one mistake I will never make again! :mad:

    Get me coffee and no one gets hurt!

    J H O B 4 Replies Last reply
    0
    • C Cp Coder

      While messing around with Java I made a stupid mistake that took me the better part of the morning to figure out: I gave the project the same name as the name of the main Java class used in the project. You shouldn't do that, I know now, but it had some weird consequences. The main problem was: If I tried to run one of the class's constructors, Java would look for the constructor in the project, not the class! I could not figure out why the compiler kept telling me that the constructor does not exist, while I knew damn well that the class does have such a constructor. :confused: In the end in desperation, I restarted the project under a different name. Problem solved! This is one mistake I will never make again! :mad:

      Get me coffee and no one gets hurt!

      J Offline
      J Offline
      Johnny J
      wrote on last edited by
      #2

      The only good java is a stong brewed java! :doh:

      Anything that is unrelated to elephants is irrelephant
      Anonymous
      -----
      The problem with quotes on the internet is that you can never tell if they're genuine
      Winston Churchill, 1944
      -----
      Never argue with a fool. Onlookers may not be able to tell the difference.
      Mark Twain

      C 1 Reply Last reply
      0
      • J Johnny J

        The only good java is a stong brewed java! :doh:

        Anything that is unrelated to elephants is irrelephant
        Anonymous
        -----
        The problem with quotes on the internet is that you can never tell if they're genuine
        Winston Churchill, 1944
        -----
        Never argue with a fool. Onlookers may not be able to tell the difference.
        Mark Twain

        C Offline
        C Offline
        Cp Coder
        wrote on last edited by
        #3

        I have to agree that brewed Java is good. But I find the programming Language interesting to learn. :)

        Get me coffee and no one gets hurt!

        1 Reply Last reply
        0
        • C Cp Coder

          While messing around with Java I made a stupid mistake that took me the better part of the morning to figure out: I gave the project the same name as the name of the main Java class used in the project. You shouldn't do that, I know now, but it had some weird consequences. The main problem was: If I tried to run one of the class's constructors, Java would look for the constructor in the project, not the class! I could not figure out why the compiler kept telling me that the constructor does not exist, while I knew damn well that the class does have such a constructor. :confused: In the end in desperation, I restarted the project under a different name. Problem solved! This is one mistake I will never make again! :mad:

          Get me coffee and no one gets hurt!

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #4

          I think your mistake was coding in Java. :laugh:

          Real programmers use butterflies

          1 Reply Last reply
          0
          • C Cp Coder

            While messing around with Java I made a stupid mistake that took me the better part of the morning to figure out: I gave the project the same name as the name of the main Java class used in the project. You shouldn't do that, I know now, but it had some weird consequences. The main problem was: If I tried to run one of the class's constructors, Java would look for the constructor in the project, not the class! I could not figure out why the compiler kept telling me that the constructor does not exist, while I knew damn well that the class does have such a constructor. :confused: In the end in desperation, I restarted the project under a different name. Problem solved! This is one mistake I will never make again! :mad:

            Get me coffee and no one gets hurt!

            O Offline
            O Offline
            obermd
            wrote on last edited by
            #5

            The mistake is using Java.

            D 1 Reply Last reply
            0
            • O obermd

              The mistake is using Java.

              D Offline
              D Offline
              Dan Neely
              wrote on last edited by
              #6

              TRWTF is replying to an old message without reading the other responses first. :doh:

              Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason? Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful? --Zachris Topelius Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies. -- Sarah Hoyt

              1 Reply Last reply
              0
              • C Cp Coder

                While messing around with Java I made a stupid mistake that took me the better part of the morning to figure out: I gave the project the same name as the name of the main Java class used in the project. You shouldn't do that, I know now, but it had some weird consequences. The main problem was: If I tried to run one of the class's constructors, Java would look for the constructor in the project, not the class! I could not figure out why the compiler kept telling me that the constructor does not exist, while I knew damn well that the class does have such a constructor. :confused: In the end in desperation, I restarted the project under a different name. Problem solved! This is one mistake I will never make again! :mad:

                Get me coffee and no one gets hurt!

                B Offline
                B Offline
                BotReject
                wrote on last edited by
                #7

                I wouldn't blame Java for this, it's probably more an issue with the IDE used to handle Java. In NetBeans I give my project names exactly the same name as the main class, and the package name is the same but all lower case as it must be = no issues. NetBeans did change the way it does all this stuff by default some years ago as I recall. Students often fail at this task, but with this simple convention nothing goes wrong.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups