JAVAC path.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    JAVAC path.

    How do i get javac path?


    Debasis Jana.
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by dmjpro
    How do i get javac path?


    Debasis Jana.
    Normally javac is stored in the bin directory of your JDK. You can use the search
    facility on Windows or the 'which' or 'find' command on Unix to find your javac
    executable file. Set the directory where javac is stored in your PATH variable
    for convenience.

    kind regards,

    Jos

    Comment

    • dmjpro
      Top Contributor
      • Jan 2007
      • 2476

      #3
      Originally posted by JosAH
      Normally javac is stored in the bin directory of your JDK. You can use the search
      facility on Windows or the 'which' or 'find' command on Unix to find your javac
      executable file. Set the directory where javac is stored in your PATH variable
      for convenience.

      kind regards,

      Jos
      I just wanted to know that ..... is there any environment variable to get that path.
      I wanna make it platform independent.
      Before you help on it ... i make my code work by setting the path variable.
      But if my code runs in UNIX platform then how do i do that in one shot... so that it becomes platform independent.... ..:-)

      Debasis Jana.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by dmjpro
        I just wanted to know that ..... is there any environment variable to get that path.
        I wanna make it platform independent.
        Before you help on it ... i make my code work by setting the path variable.
        But if my code runs in UNIX platform then how do i do that in one shot... so that it becomes platform independent.... ..:-)

        Debasis Jana.
        Well, that should be part of your installation procedure; it's that program that
        installs the javac compiler so it's that program's responsibility to put that directory
        in the path variable. There is no free lunch where automagically an environment
        such as JAVA_HOME will be created for you. Neither on a Windows Box nor
        on a Unix box. The day that computers will be psychic will be in the far future.

        kind regards,

        Jos

        Comment

        • dmjpro
          Top Contributor
          • Jan 2007
          • 2476

          #5
          Originally posted by JosAH
          Well, that should be part of your installation procedure; it's that program that
          installs the javac compiler so it's that program's responsibility to put that directory
          in the path variable. There is no free lunch where automagically an environment
          such as JAVA_HOME will be created for you. Neither on a Windows Box nor
          on a Unix box. The day that computers will be psychic will be in the far future.

          kind regards,

          Jos
          So that should be part of my installation code ...
          i understand .......
          one more thing JOS ......
          How could i know that my machine in having java or not????

          Debasis Jana.

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by dmjpro
            So that should be part of my installation code ...
            i understand .......
            one more thing JOS ......
            How could i know that my machine in having java or not????

            Debasis Jana.
            Obviously you can't test that using a Java program so you need something else;
            e.g. a shell script that tries to run "java -version". If it fails you don't have Java
            installed or present in the path variable.

            kind regards,

            Jos

            Comment

            • chaarmann
              Recognized Expert Contributor
              • Nov 2007
              • 785

              #7
              Originally posted by dmjpro
              I just wanted to know that ..... is there any environment variable to get that path.
              I wanna make it platform independent.
              Before you help on it ... i make my code work by setting the path variable.
              But if my code runs in UNIX platform then how do i do that in one shot... so that it becomes platform independent.... ..:-)

              Debasis Jana.

              What if you try to figure out the platform first in your code?
              Then you can try to find it in the default installation folders.
              If it cannot be found there, then you have to ask the user where it is.
              Or at least prefill the textboxes during installation.
              This will take some headache away from most users, because the users with less experience will nearly always install it in the default folder and they don't remember where it was afterwards, whereas the experts would choose some special folders, but then the experts will remember where it was.

              The path is usually stored in the environment variable JAVA_HOME.
              You could also check the CLASSPATH variable.

              On Windows XP, you can also check the registry to make sure he has it installed and which versions are installed. See keys under Software-->JavaSoft

              Comment

              • dmjpro
                Top Contributor
                • Jan 2007
                • 2476

                #8
                Originally posted by chaarmann
                What if you try to figure out the platform first in your code?
                Then you can try to find it in the default installation folders.
                If it cannot be found there, then you have to ask the user where it is.
                Or at least prefill the textboxes during installation.
                This will take some headache away from most users, because the users with less experience will nearly always install it in the default folder and they don't remember where it was afterwards, whereas the experts would choose some special folders, but then the experts will remember where it was.

                The path is usually stored in the environment variable JAVA_HOME.
                You could also check the CLASSPATH variable.

                On Windows XP, you can also check the registry to make sure he has it installed and which versions are installed. See keys under Software-->JavaSoft

                Could I get that JAVA_HOME environment variable in UNIX platform?

                Debasis Jana.

                Comment

                • r035198x
                  MVP
                  • Sep 2006
                  • 13225

                  #9
                  Originally posted by dmjpro
                  Could I get that JAVA_HOME environment variable in UNIX platform?

                  Debasis Jana.
                  Code:
                  echo $JAVA_HOME
                  .

                  Comment

                  • chaarmann
                    Recognized Expert Contributor
                    • Nov 2007
                    • 785

                    #10
                    Originally posted by dmjpro
                    Could I get that JAVA_HOME environment variable in UNIX platform?

                    Debasis Jana.
                    you can execute "env" command to see all environment variables.

                    In our Solaris (Sun-machine) the environment variable "JAVA_HOME" is set, also the "CLASSPATH" , for all users. Usually the CLASSPATH is always set, because it is recognized by every "javac" or "java"

                    Comment

                    • dmjpro
                      Top Contributor
                      • Jan 2007
                      • 2476

                      #11
                      Hi .....Alll....
                      What I looked for that I solved ... :-)
                      Just a common think I could not do it ...
                      anyway ....I managed 2 do that I simply set tha path and accessing the javac and jar

                      Debasis Jana.

                      Comment

                      • JosAH
                        Recognized Expert MVP
                        • Mar 2007
                        • 11453

                        #12
                        Originally posted by dmjpro
                        Hi .....Alll....
                        What I looked for that I solved ... :-)
                        Just a common think I could not do it ...
                        anyway ....I managed 2 do that I simply set tha path and accessing the javac and jar

                        Debasis Jana.
                        But what about your question then if there was no JDK installed? Your questions
                        are just wondering around with no specified goal.

                        kind regards,

                        Jos

                        Comment

                        • dmjpro
                          Top Contributor
                          • Jan 2007
                          • 2476

                          #13
                          Originally posted by JosAH
                          But what about your question then if there was no JDK installed? Your questions
                          are just wondering around with no specified goal.

                          kind regards,

                          Jos

                          lolz!
                          no no JOS ..my target was the first one ..
                          I just contextually asked it ....
                          Actually i was in hectic ...today I finished ....that .....
                          Anyway I ll try to find out whether .... JDK installed or not ....
                          I promise i won't start it in new THREAD ..... :-)
                          Tomorrow is my job delivery ...

                          Debasis Jana ..

                          Comment

                          Working...