Results 1 to 9 of 9

Thread: confused about java

  1. #1
    grglsn NNTP User

    Default confused about java

    I am working on a project that says I need to have JDK 7.13 installed.
    So I went to the page
    http://docs.oracle.com/javase/7/docs...linux-jdk.html
    that was provided in the tutorial I was following.

    There are rpm packages there to download, but I started to think that I
    already have java installed. So I checked and found out that this is
    what I have installed:

    Code:
    java-1_7_0-openjdk-1.7.0.6-8.8.1.x86_64
    That package was from the update repos.

    On the website I linked to, the following package is available:
    Code:
    jdk-7u<version>-linux-x64.rpm
    On oracle's website, I see that 7u21 is available, but apparently I only
    need 7u13 for this one.

    What is the difference between java-1_7_0-openjdk-1.7 available from the
    opensuse repos and JDK 7.13 that my instructions say I have to install?
    The version from the repos does have the letters "jdk" in them. But
    since it is "open" jdk instead of "jdk-d...", does that mean this is a
    completely different package? Do I need to install the jdk direct from
    oracle?

    --
    G.O.
    Box #1: 12.3 | KDE 4.10 | AMD Phenom IIX4 | 64 | 16GB
    Box #2: 12.2 | KDE 4.9.2 | AMD Athlon X3 | 64 | 4GB
    Laptop: 12.3 | KDE 4.10 | Core i7-2620M | 64 | 8GB
    learning openSUSE and loving it

  2. #2
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: confused about java

    On 2013-05-13 00:45, grglsn wrote:

    > On oracle's website, I see that 7u21 is available, but apparently I only
    > need 7u13 for this one.


    You need the latest version, always. Documentation gets obsolete soon.
    Older versions have security holes.


    > What is the difference between java-1_7_0-openjdk-1.7 available from the
    > opensuse repos and JDK 7.13 that my instructions say I have to install?
    > The version from the repos does have the letters "jdk" in them. But
    > since it is "open" jdk instead of "jdk-d...", does that mean this is a
    > completely different package? Do I need to install the jdk direct from
    > oracle?


    It is possible that the java obtained from openSUSE works for you, and
    that is easier to install. On the other hand, it is also possible that
    you really need to use the Oracle version - and in this case in fact you
    have to install both.

    You need to install the version packaged by openSUSE (I think there are
    two, IIRC: gcc and icedtea) because that's the only one that is
    recognized by YaST as java. If you remove it, the system will remove
    every other package that needs java, like LibreOffice. So live with it.

    And then you need the Oracle one (if you do). You simply tell the system
    which to use with "updatealternatives".


    All the above is mainly above just "java". About the toolkit, I know
    little, but you will need the kit matching the java version you use.


    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)

  3. #3
    Join Date
    Aug 2008
    Location
    Seattle, WA
    Posts
    1,376

    Default Re: confused about java

    The main difference between openJDK and Oracle's JDK is that one is open source while the other is tangled with patents. Obviously, they use different version numbering systems, too. I'm sure the open version is up to date, but if you want to confirm this, try the developer sub-forum, or there's a Java mailing list for openSUSE.

    openSUSE:Mailing lists - openSUSE

  4. #4
    Join Date
    Sep 2012
    Location
    Maryland, US
    Posts
    623

    Default Re: confused about java

    Quote Originally Posted by robin_listas View Post
    You need the latest version, always
    This is not always true and many java programs only work with a particular version of java. A good example is the Android SDK which only works with java 1.6. There is a way to switch java versions if you have a program that needs a different one besides the default or latest version. I had a post about this some time ago so if you search for "switch java" you may find some good posts. Actually the "setting sun java as default" is a good read.
    Kernel: 4.12.14-lp150.12.7-default x86_64 bits:
    64 Desktop: Gnome 3.26.2
    Distro: openSUSE Leap 15.0

  5. #5

    Default Re: confused about java

    Quote Originally Posted by grglsn View Post
    I am working on a project that says I need to have JDK 7.13 installed.
    There are two types of java installations:

    1. JRE (java runtime environment) - which lets you 'run' java applications
    2. JDK (java development kit) - lets you 'develop' java applications.


    To check if you have #1 installed and working correctly:
    1. run
    Code:
    java -version
    You should see something similar if you have it installed:
    Code:
    :~> java -version
    java version "1.7.0_11"
    Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
    Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)
    To check if you have #1 functioning well in browsers, go to Verify Java Version and click verify java version button.

    If you are working on a project, which needs java only to run (not to develop) then you can install JRE. There are a number of ways you can do it. I have also packaged one installer which will download the JRE from Oracle's site, and installs it for you. It also creates necessary symlinks so it works with browser. You can install it from here if you want:
    Index of /repositories/home:/wildnux/openSUSE_12.3

    If you are working on a project to 'develop' a java application, you should have JDK. Now, you can use proprietary Java from Oracle (which most people use) or you can use OpenJDK (which is opensource). Both are free to use. I have had some problems when using OpenJDK with other applications that were developed and build with Sun's Java before. So personally I just use Oracle's JDK.

    Without installing a JDK rpm, you can use JDK by doing the following:

    1. download the JDK from Oracle's site: Java SE Downloads
    (I have 64bit computer so I download the 64-but zipped file (eg: jdk-7u21-linux-x64.tar.gz) )
    2. I will then extract it to some directory say : /home/USERNAME/jdk/
    (such that inside that directory i will have now bin, db, include, jre, lib, man, etc.)
    3. I now set my JAVA_HOME environment variable to that directory. I do that by editing .bashrc file in my home directory (create if not there) and adding:
    Code:
    # for JDK
    export JAVA_HOME=/home/USERNAME/jdk/
    (dont forget to change USERNAME to your username )

    4. Log out and log back in. (or start on a new konsole) Now your application/ project should work.

    To do a quick check you can do:
    1. execute "which javac" without quotes in konsole, it should give you : /home/USERNAME/jdk/bin/javac

    2. execute "javac -version" without quotes in konsole, it should show you version number similar to:
    Code:
    ~> javac -version
    javac 1.7.0_11
    The advantage of this method is that you have the whole JDK in your ~/jdk/ directory, you can update it to newer version by just downloading a new one and delete/move the old one, and extract the new one to the same location.

    Note that you can use symlinks (shortcuts) instead of extracting directly into ~/jdk, you can just extract to /home/USERNAME/java/jdk-version-blah-blah/ and then just create a symlink using:
    Code:
    ln -s /home/USERNAME/java/jdk-version-blah-blah /home/USERNAME/jdk
    This way you can keep multiple JDK versions inside ~/java directory and just link to the one that you want to use.
    ___________________________________________

    नेपालीको छोरो
    help spread the word of linux
    ___________________________________________

  6. #6
    Join Date
    May 2010
    Location
    Space Colony Lagrange Point 22° à, 77° Ƅ, 56° ɤ, 99° ɜ
    Posts
    3,166

    Default Re: confused about java

    Quote Originally Posted by grglsn View Post
    project that says I need to have JDK 7.13 installed.
    So you need to develop or run jars ?

    • you need a JRE to run jars
    • you need JDK to develop applications.

    But openJDK is not really JDK ,the openJDK which gets installed on your machine by default is actually a JRE.
    openJDK-devel package needs to be installed to develop applications.

    Generally you cannot have both openJDK and oracle JRE/JDK installed at a time.

    oracle JDK can be downloaded here:-
    Java SE Downloads
    oracle JRE can be downloaded here
    Download Java software for Linux

    oracle/sun jre installation https://sites.google.com/site/easyli...a-for-opensuse
    GNOME Version 3.20.2
    openSUSE Leap 42.3 64-bit

    www.vazhavandan.blogspot.com

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: confused about java

    On 2013-05-16 03:26, anika200 wrote:
    >
    > robin_listas;2556357 Wrote:
    >>
    >> You need the latest version, always

    >
    > This is not always true and many java programs only work with a
    > particular version of java. A good example is the Android SDK which only
    > works with java 1.6.


    Ah... interesting. Yes, it can happen. Unfortunate, though, and a
    security risk.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)

  8. #8
    Join Date
    May 2010
    Location
    Space Colony Lagrange Point 22° à, 77° Ƅ, 56° ɤ, 99° ɜ
    Posts
    3,166

    Default Re: confused about java

    Quote Originally Posted by robin_listas View Post
    On 2013-05-16 03:26, anika200 wrote:
    >
    > robin_listas;2556357 Wrote:
    >>
    >> You need the latest version, always

    >
    > This is not always true and many java programs only work with a
    > particular version of java. A good example is the Android SDK which only
    > works with java 1.6.


    Ah... interesting. Yes, it can happen. Unfortunate, though, and a
    security risk.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)
    I know that they deprecate methods and classes in java but they do retain those *junk* methods to maintain compatibility with previous versions of java
    GNOME Version 3.20.2
    openSUSE Leap 42.3 64-bit

    www.vazhavandan.blogspot.com

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: confused about java

    On 2013-05-16 05:46, vazhavandan wrote:
    > I know that they deprecate methods and classes in java but they do
    > retain those *junk* methods to maintain compatibility with previous
    > versions of java


    Yes, I understand. If you have to use some old tools, you have to, such
    is life.

    I would use that software as contained as possible, it could be a risk.
    Oracle itself announced they were stopping making updates for 1.6
    version some months ago.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.1 x86_64 "Asparagus" at Telcontar)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •