infamous hello world

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • change
    New Member
    • Dec 2007
    • 26

    infamous hello world

    scribes

    I am trying to run the infamous hello world script in java and when i compile in dos prompt using the folling code "javac helloworld.java " i get the error message
    javac is not recognised as an internal or external command, operable program or batch file. I have saved the script in this directory: c:\java\ ...

    thanks in advance
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    That was a message from your shell (command line interpreter); it can't find
    anything named 'javac.exe'. Set your PATH variable to the directory where your
    javac.exe is stored. This has nothing to do with java.

    kind regards,

    Jos

    Comment

    • change
      New Member
      • Dec 2007
      • 26

      #3
      hi this is where java is so how do i set the path

      C:\Program Files\java\jre1 .6.0_06\bin

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by change
        hi this is where java is so how do i set the path

        C:\Program Files\java\jre1 .6.0_06\bin
        Nope, that's not where your PATH variable should point to.That is not the location
        where your 'javac.exe' command is stored (note the trailing 'c').

        Move to your jdk directory where you will find both 'java' and 'javac' in its bin
        directory. The jdk directory is stored next to this jre directory.

        kind regards,

        Jos

        Comment

        • change
          New Member
          • Dec 2007
          • 26

          #5
          hi i only have the jre directory and no jkd

          how do i proceed now

          regards

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by change
            hi i only have the jre directory and no jkd

            how do i proceed now

            regards
            If you don't have a jdk (Java Development Kit) you don't have javac nor the other
            tools. Better get rid of this jre and download a complete jdk (plus a bundled jre)
            from this link.

            You need JDK 6 update 6 (the second paragraph on that page).

            kind regards,

            Jos

            Comment

            • ajos
              Contributor
              • Aug 2007
              • 283

              #7
              Originally posted by change
              hi i only have the jre directory and no jkd

              how do i proceed now

              regards
              Proceed by installing the latest copy of jdk and jre from the Sun's official site and read the instructions on how to set up Java on the local machine.

              Only jre wont do, you need both the jdk and jre to run.
              Last edited by ajos; Jun 13 '08, 09:25 AM. Reason: jos beat me to it ;)

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                ps. also have a look at our little Java Articles Index page; it contains
                links to the entire documentation of your Java SE installation; ready for download
                (hint hint) and some more useful stuff.

                kind regards,

                Jos

                Comment

                • change
                  New Member
                  • Dec 2007
                  • 26

                  #9
                  i have down loaded the jdk and installed...how do i set the directory to point to where the java c is i on a windows machine...

                  Comment

                  • JosAH
                    Recognized Expert MVP
                    • Mar 2007
                    • 11453

                    #10
                    Originally posted by change
                    i have down loaded the jdk and installed...how do i set the directory to point to where the java c is i on a windows machine...
                    Control Panel > System > Advanced > Environment Variables.

                    kind regards,

                    Jos

                    Comment

                    • change
                      New Member
                      • Dec 2007
                      • 26

                      #11
                      do i paste this on the C:\Program Files\java\jdk1 .6.0_06\bin on the user variables or the system variables

                      Comment

                      • ajos
                        Contributor
                        • Aug 2007
                        • 283

                        #12
                        Originally posted by change
                        do i paste this on the C:\Program Files\java\jdk1 .6.0_06\bin on the user variables or the system variables
                        Read the installation manuals from where you installed Java, also the articles jos posted. Alternately google for setting classpath for java.

                        Comment

                        • JosAH
                          Recognized Expert MVP
                          • Mar 2007
                          • 11453

                          #13
                          Originally posted by change
                          do i paste this on the C:\Program Files\java\jdk1 .6.0_06\bin on the user variables or the system variables
                          I took the coward's approach: I checked which one of them already had a PATH
                          variable defined; there I added that jdk directory. Otherwise simply add it to the
                          system's part.

                          kind regards,

                          Jos

                          Comment

                          • sukatoa
                            Contributor
                            • Nov 2007
                            • 539

                            #14
                            Originally posted by change
                            i have down loaded the jdk and installed...how do i set the directory to point to where the java c is i on a windows machine...
                            i think the installer already programmed to add a classpath in the System variables in Windows.... @ jdk 6.x version

                            Comment

                            • JosAH
                              Recognized Expert MVP
                              • Mar 2007
                              • 11453

                              #15
                              Originally posted by sukatoa
                              i think the installer already programmed to add a classpath in the System variables in Windows.... @ jdk 6.x version
                              Not that I know of; if I remember well I always have to set my PATH variable to
                              the appropriate directory manually.

                              kind regards,

                              Jos

                              Comment

                              Working...