Announcement

Collapse
No announcement yet.

Understanding the java install

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Understanding the java install

    Hey all -

    I am sure everyone is probably sick of hearing about how to install Java but this isn't about how to install it
    It's more about understanding how it's working.

    I installed the jdk 6 using the repos and I can compile and run a java program just fine.
    My question is why didn't I have to modify my .bashrc or .profile to set java_home or anything like that?
    I checked both of those files and it's not there either. Just curious how it all works without that their because
    every instruction I find on how to install java says to do that.

    Thanks!

    #2
    Re: Understanding the java install

    Ok, so I now understand that I need to edit the .bashrc myslef or at least I am thinking so.

    When I attempt to use a library it gives me an error that it can 't find it.
    So I edited the .bashrc with the following but it's still now allowing me to create a
    File object from java.io.*;
    Could someone please tell me what I am doing incorrectly?

    Thankns!

    JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.00
    export JAVA_HOME

    export PATH=$PATH:/usr/lib/jvm/java-6-sun-1.6.0.00/bin

    CLASSPATH=/usr/lib/jvm/java-6-sun-1.6.0.00/lib/tools.jar:/usr/lib/jvm/java-6-sun-1.6.0.00/lib/dt.jar
    export CLASSPATH

    Comment


      #3
      Re: Understanding the java install

      It may help if you post the exact error message you're getting and more specifics about the context you're using it in... I've used Java 1.5 - uh, 5 (1.6 - uh, 6 is too new for me to trust) without having to touch .bashrc or .profile.

      Comment


        #4
        Re: Understanding the java install

        Here it is:

        Code:
        Test.java:5: cannot find symbol
        symbol : constructor File()
        location: class java.io.File
                File f = new File();
                     ^
        1 error

        Comment


          #5
          Re: Understanding the java install

          I have to apologize for my errr error -
          It's not a configuration problem it's an API problem lol
          the file object doesn't have an no arg constructor ha guess I need to pay attention..

          Comment


            #6
            Re: Understanding the java install

            Thought it might have been something like that

            Comment


              #7
              Re: Understanding the java install

              FYI, you do not need to set JAVA_HOME (in fact, I'd strongly recommend NOT setting it). You'll only need to do that for third-party software that expects that to be set for script execution. The requirement for setting it mostly went away several years ago (I think with Java 1.3). If you do find an occasional requirement to set it, only do so for that application/bash-session - don't do it "globally."

              Likewise, do NOT explicitly set the CLASSPATH variable. The JVM can find the runtime JARs just fine. And, more often than not, you'll find that it will mess you up somewhere down the road.
              E. A. (Ed) Graham, Jr.<br />Professional Java Geek<br />Linux User #28251

              Comment


                #8
                Re: Understanding the java install

                I didn't realize that setting those environment variables went away years ago...
                Why then do almost every instruction given to noobs regarding setting up java on linux involve setting these variables?

                Guess I am wondering if we do not need to set these any longer what changed in that we do not have to now?

                Thanks for the help!

                Comment


                  #9
                  Re: Understanding the java install

                  I don't have .bashrc so I created one. These are the only entries that I have.

                  export JAVA_HOME=/usr/lib/jvm/java-6-sun
                  export PATH=$PATH:$JAVA_HOME/bin

                  Got my Netbeans working after doing this.
                  Dax Solomon Umaming<br />http://blog.knightlust.com/

                  Comment

                  Working...
                  X