Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to avoid Oracle's JAVA
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 770
Location: US-FL-EST

PostPosted: Wed Apr 22, 2015 12:35 am    Post subject: How to avoid Oracle's JAVA Reply with quote

Recently, dev-java/oracle-jdk-bin-1.8.0.X and dev-java/oracle-jre-bin-1.8.0.X were marked stable. That makes Oracle's Java the only level of Java 1.8 which is also marked stable for virtual/jre-1.7.0(stable), virtual/jre-1.8.0(unstable), virtual/jre-1.7.0(stable) and virtual/jre-1.8.0(unstable). You may want to read Gentoo Bugzilla #506162 comment #2. What this means is that portage will want to 'upgrade' you from IcedTea's (OpenJDK) equvalent of Java 1.7 to Oracle's Java 1.8 regardless of whether you run stable or unstable.

There are arguments for and against holding up marking these as stable in order to wait until the equivalent versions of Icedtea-bin are ready. I have no interest in partipating in those discussions and frankly consider them to be wasteful of time since the solution is so easy if you, like me, prefer to not have Oracle's Java loaded onto your systems.

  • Step 1) - We need to know what the actual minimum version of virtual/jdk and virtual/jre we really need. The reason for this is to determine which level of Java 1.X we need to have installed. To do this, we run 'equery'. 'equery' is a portage tool included in 'app-portage/gentoolkit'. If you have not already install 'gentoolkit', then execute:
    Code:
    emerge app-portage/gentoolkit

    Now execute:
    Code:
    equery d virtual/jre
     * These packages depend on virtual/jre:
    app-eselect/eselect-java-0.1.0 (>=virtual/jre-1.5)
    app-office/libreoffice-4.4.2.2 (java ? >=virtual/jre-1.6)
    dev-java/jgoodies-looks-1.2.2-r2 (>=virtual/jre-1.5)
    dev-java/swt-3.7.2-r1 (>=virtual/jre-1.4)
    dev-lang/R-3.1.2 (java ? >=virtual/jre-1.5)
    dev-libs/protobuf-2.6.1-r3 (java ? >=virtual/jre-1.5)
    dev-vcs/subversion-1.8.13 (java ? >=virtual/jre-1.5)
    games-board/domination-1.1.1.5 (>=virtual/jre-1.5)
    kde-base/poxml-4.14.3 (extras ? >=virtual/jre-1.5)
    media-gfx/aoi-2.7.2 (>=virtual/jre-1.5)
    media-gfx/opcion-1.1.1-r2 (>=virtual/jre-1.4)
    media-libs/libbluray-0.7.0 (java ? >=virtual/jre-1.6)
    media-libs/libcaca-0.99_beta19 (java ? >=virtual/jre-1.5)
    media-libs/libjpeg-turbo-1.4.0 (java ? >=virtual/jre-1.5)
    media-libs/opencv-2.4.10 (java ? >=virtual/jre-1.6)
    media-video/bdsup2sub-4.0.0-r1 (>=virtual/jre-1.6)
    net-dns/libidn-1.30 (java ? >=virtual/jre-1.5)
    net-print/cups-2.0.2-r1 (java ? >=virtual/jre-1.6)
    sys-devel/gettext-0.19.4 (java ? >=virtual/jre-1.4)
    sys-libs/db-5.3.28-r2 (java ? >=virtual/jre-1.5)
    sys-libs/db-6.0.30-r1 (java ? >=virtual/jre-1.5)

    and also execute:
    Code:
    equery d virtual/jdk
     * These packages depend on virtual/jdk:
    app-office/libreoffice-4.4.2.2 (java ? >=virtual/jdk-1.6)
    dev-java/ant-core-1.9.2 (>=virtual/jdk-1.5)
    dev-java/ant-owanttask-1.3.2 (>=virtual/jdk-1.4)
    dev-java/asm-2.0-r1 (>=virtual/jdk-1.3)
    dev-java/bcel-6.0_rc3 (>=virtual/jdk-1.5)
    dev-java/gnu-regexp-1.1.4-r2 (>=virtual/jdk-1.4)
    dev-java/jarjar-0.9 (>=virtual/jdk-1.4)
    dev-java/java-getopt-1.0.14 (>=virtual/jdk-1.4)
    dev-java/javacup-0.11a_beta20060608 (>=virtual/jdk-1.4)
    dev-java/jgoodies-looks-1.2.2-r2 (>=virtual/jdk-1.5)
    dev-java/junit-3.8.2-r1 (>=virtual/jdk-1.4)
    dev-java/relaxng-datatype-1.0-r1 (>=virtual/jdk-1.4)
    dev-java/saxpath-1.0-r2 (>=virtual/jdk-1.4)
    dev-java/swt-3.7.2-r1 (>=virtual/jdk-1.4)
    dev-java/xalan-2.7.1 (>=virtual/jdk-1.4)
    dev-java/xalan-serializer-2.7.1 (>=virtual/jdk-1.4)
    dev-java/xerces-2.11.0 (>=virtual/jdk-1.4)
    dev-java/xjavac-20110814 (>=virtual/jdk-1.4)
    dev-java/xml-commons-external-1.3.04 (>=virtual/jdk-1.3)
    dev-java/xml-commons-external-1.4.01 (>=virtual/jdk-1.3)
    dev-java/xml-commons-resolver-1.2 (>=virtual/jdk-1.3)
    dev-java/xom-1.2.10 (>=virtual/jdk-1.4)
    dev-java/xpp2-2.1.10-r1 (>=virtual/jdk-1.3)
    dev-java/xpp3-1.1.4c-r1 (>=virtual/jdk-1.4)
    dev-lang/erlang-17.5 (java ? >=virtual/jdk-1.2)
    dev-libs/cyrus-sasl-2.1.26-r9 (java ? >=virtual/jdk-1.4)
    dev-libs/protobuf-2.6.1-r3 (java ? >=virtual/jdk-1.5)
    dev-util/android-sdk-update-manager-23 (>=virtual/jdk-1.5)
    dev-vcs/subversion-1.8.13 (java ? >=virtual/jdk-1.5)
    games-board/domination-1.1.1.5 (>=virtual/jdk-1.5)
    kde-base/krossjava-4.14.3 (>=virtual/jdk-1.5)
    kde-base/poxml-4.14.3 (extras ? >=virtual/jdk-1.5)
    media-gfx/graphviz-2.38.0 (java ? >=virtual/jdk-1.5)
    media-gfx/opcion-1.1.1-r2 (>=virtual/jdk-1.4)
    media-libs/libbluray-0.7.0 (java ? >=virtual/jdk-1.6)
    media-libs/libcaca-0.99_beta19 (java ? >=virtual/jdk-1.5)
    media-libs/libjpeg-turbo-1.4.0 (java ? >=virtual/jdk-1.5)
    media-libs/opencv-2.4.10 (java ? >=virtual/jdk-1.6)
    media-video/bdsup2sub-4.0.0-r1 (>=virtual/jdk-1.6)
    net-dns/libidn-1.30 (java ? >=virtual/jdk-1.5)
    sys-devel/gettext-0.19.4 (java ? >=virtual/jdk-1.4)
    sys-libs/db-5.3.28-r2 (java ? >=virtual/jdk-1.5)
    sys-libs/db-6.0.30-r1 (java ? >=virtual/jdk-1.5)

    What 'equery' is doing here is listing all the packages that are already installed on your system which might require java and what the oldest version of java is that will work.

    What you're looking for is the latest (highest numbered) version of virtual/jdk-jre. As you can see from this system, 1.6 Java is the oldest version of Java I can install which will work with all of my currently installed packages which list Java as a(n) (optional) dependency.

    When checking what level of Java you need to have installed, ignore lines like these:
    Code:
    virtual/jre-1.7.0 (=virtual/jdk-1.7.0*)
    virtual/jre-1.8.0 (=virtual/jdk-1.8.0*)

    Because how 'virtual' works, these packages are self-referential as dependencies.

  • Step 2) - Once we determine what our oldest version of Java can be (which will work with all of our packages which need Java!), we're ready to inform portage that we don't want Oracle's Java to be considered.

    I take advantage of portage's capability to have a directory of portage package mask files. My example here reflects that. Execute the following:
    Code:
    nano -w /etc/portage/package.mask/oracle

    Add the following lines:
    Code:
    dev-java/oracle-jdk-bin
    dev-java/oracle-jre-bin
    =virtual/jdk-1.8.0
    =virtual/jre-1.8.0

    If you have only the /etc/portage/package.mask file instead of the directory, then execute the following instead of my previous example:
    Code:
    echo "dev-java/oracle-jdk-bin" >> /etc/portage/package.mask
    echo "dev-java/oracle-jre-bin" >> /etc/portage/package.mask
    echo "=virtual/jdk-1.8.0" >> /etc/portage/package.mask
    echo "=virtual/jre-1.8.0" >> /etc/portage/package.mask

    The first two lines mask all of Oracle's jdk and jre packages. For those of us running 'unstable', the second two lines block the virtual/jdk(jre) 1.8 versions which can only be sastisfied by Oracle's Java 1.8 at this time. This way, the Oracle Java packages are blocked and portage won't complain about not being able to upgrade the virtual packages until you/they are ready for the equivalent 1.8 Icedtea packages.

  • Step 3) - If you're here because Oracle's Java is already installed as happened to me, we need to do a little cleanup. To get rid of any newly installed packages we don't want, execute the following:
    Code:
    emerge -C dev-java/oracle-jdk-bin =virtual/jdk-1.8.0 =virtual/jre-1.8.0

    Now perform an @world emerge to let portage re-install the latest version of Icedtea (stable or unstable) which is suitable for your system. I use this command because I like to be sure the packages are pre-downloaded first:
    Code:
    date && time emerge -fuND --with-bdeps=y --keep-going @world && time emerge -uND --with-bdeps=y --keep-going @world && date

    Be sure that the correct Java VM is selected for your environment:
    Code:
    pyrodyno ~ # java-config -L
    The following VMs are available for generation-2:
    1)      IcedTea JDK 7.2.5.3 [icedtea-bin-7]
    pyrodyno ~ # java-config -S 1
    Now using icedtea-bin-7 as your generation-2 system JVM
    pyrodyno ~ # java-config -L
    The following VMs are available for generation-2:
    *)      IcedTea JDK 7.2.5.3 [icedtea-bin-7]


All done. Now, you'll only need to keep an eye open for future messages complaining that an upgrade to IcedTea JDK 8.X has unmet depencies because 'virtual/jdk(jre)-1.8.0' is masked. You'll also need to keep alert for a possible revision to these virtuals as well since we chose to only mask version 1.8.0. Personally, I'm hoping that a revision of the 1.8.0 virtuals means that IcedTea 8.X has been unmasked. This is why I chose to mask only the specific 1.8.0 versions. Ideally, if the IcedTea upgrade and the virtual revisions come at the same time, then you won't need to do anything.

edited to clarify what was actually happening. It was Oracle's version of Java 1.8 which was marked stable.
_________________
People whom think M$ is mediocre, don't know the half of it.


Last edited by dufeu on Wed Apr 22, 2015 7:36 pm; edited 2 times in total
Back to top
View user's profile Send private message
muaddib
Apprentice
Apprentice


Joined: 16 Sep 2005
Posts: 276

PostPosted: Wed Apr 22, 2015 2:22 am    Post subject: Reply with quote

Great HOWTO !

Here's a little helper. What about using this :

$ equery d virtual/jre | cut -c 2- | sort -n | tail -n 1

AND

$ equery d virtual/jdk | cut -c 2- | sort -n | tail -n 1

to get the highest version numbers directly !

Might help if someone has a lot of things depending on the JRE/JDK.
_________________
P.
Back to top
View user's profile Send private message
charles17
l33t
l33t


Joined: 02 Mar 2008
Posts: 885

PostPosted: Wed Apr 22, 2015 7:03 am    Post subject: Re: How to avoid Oracle's JAVA Reply with quote

dufeu wrote:
If you have only the /etc/portage/package.mask file instead of the directory, then execute the following instead of my previous example:
Code:
echo "dev-java/oracle-jdk-bin" >> /etc/portage/package.mask
echo "dev-java/oracle-jre-bin" >> /etc/portage/package.mask
echo "=virtual/jdk-1.8.0" >> /etc/portage/package.mask
echo "=virtual/jre-1.8.0" >> /etc/portage/package.mask
On a stable system there s no need for masking as virtual/jre:1.8 and virtual/jdk:1.8 are unstable and will not get pulled in at all.
And for the 1.7, it's sufficient to have dev-java/icedtea ~<your arch> in package.keywords.
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 770
Location: US-FL-EST

PostPosted: Wed Apr 22, 2015 11:53 am    Post subject: Reply with quote

muaddib wrote:
Great HOWTO !

Here's a little helper. What about using this :

$ equery d virtual/jre | cut -c 2- | sort -n | tail -n 1

AND

$ equery d virtual/jdk | cut -c 2- | sort -n | tail -n 1

to get the highest version numbers directly !

Might help if someone has a lot of things depending on the JRE/JDK.

This is a great suggestion and I appreciate it. I won't be incorporating it in my OP as it comes under what I consider 'advanced usage'.

When I write one of these kinds of 'How-tos', I'm usually targeting people savy but not yet experienced. I therefore write taking the clearest to understand, somewhat bruteforce approach. In particular, I want my target readers to actually see what packages on their systems require which levels of Java. Most people get and understand direct dependencies. Because of the interaction of the 'virtual' packages, you can't run 'equery d java' or 'equery d icedtea-bin'. The first is meaningless and the second only points you back to the virtuals. So I considered it a Good Thing to have people see how to find all the packages depending on a virtual instead of directly on the immediate dependency.

On the other hand, your suggestion is a great follow on to more efficient advanced usage. ;)

Thanks!
_________________
People whom think M$ is mediocre, don't know the half of it.
Back to top
View user's profile Send private message
dufeu
l33t
l33t


Joined: 30 Aug 2002
Posts: 770
Location: US-FL-EST

PostPosted: Wed Apr 22, 2015 12:02 pm    Post subject: Re: How to avoid Oracle's JAVA Reply with quote

charles17 wrote:
On a stable system there s no need for masking as virtual/jre:1.8 and virtual/jdk:1.8 are unstable and will not get pulled in at all.
And for the 1.7, it's sufficient to have dev-java/icedtea ~<your arch> in package.keywords.

Thank you for pointing this out. I had read some earlier posts too quickly. ;)

I adjusted the OP to reflect that it's Oracle's Java 1.8 which was marked 'stable' and not the corresponding virtual/jdk(jre) 1.8 packages. People running stable only need to mask Oracle's Java. People running unstable need to block both Oracle's Java and the 1.8 virtuals. It does no harm to also have people running stable block the 1.8 virtuals.

The steps I listed work and should be clear to the target readers without confusing them.

Again - Thanks!
_________________
People whom think M$ is mediocre, don't know the half of it.


Last edited by dufeu on Wed Apr 22, 2015 6:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
pilla
Administrator
Administrator


Joined: 07 Aug 2002
Posts: 7232
Location: Pelotas, BR

PostPosted: Wed Apr 22, 2015 1:45 pm    Post subject: Reply with quote

Moved from Portage & Programming to Documentation, Tips & Tricks.
_________________
"I'm just very selective about the reality I choose to accept." -- Calvin
Back to top
View user's profile Send private message
miroR
Guru
Guru


Joined: 05 Mar 2008
Posts: 575

PostPosted: Sat May 02, 2015 4:09 pm    Post subject: Reply with quote

Thanks! This tip saved my day.

I recommended it in my quest:

Air-Gapped Gentoo Install, Tentative
https://forums.gentoo.org/viewtopic-t-987268-start-50.html#7741684
_________________
Miroslav Rovis
Zagreb, Croatia
www.CroatiaFidelis.hr
Try refute: rootkit hooks in kernel,
linux capabilities for intrusion? (Linus?)
Back to top
View user's profile Send private message
miroR
Guru
Guru


Joined: 05 Mar 2008
Posts: 575

PostPosted: Sat May 02, 2015 5:44 pm    Post subject: Reply with quote

I was thinking... Lots of people, from newbies to somewhat advanced like me, would like to get to this information.

I'm somewhat experienced, but it would have taken me longer to figure this issue without this guide! I actually searched the web, without going in depth on the results (I duck for info, meaning I use DuckDuckGo.com), and after first not too long search (but I use dillo --which is safe but rudimental, features missing--, as the unsafe --surveilling-- Firefox is in bed with my enemy Google (

Really? The Surveillance Engine Terminated All My Videos
http://forums.debian.net/viewtopic.php?f=3&t=113059

), and in that first search I even made a few steps in wrong direction before I decided to seek advice/help on Gentoo Forums.

It's not obvious, and it looks like it was made not to obvious. Just accept the freaking license and all is well...

Similar to the issue of:

Libav (Avconv) Imposition on Users who want FFmpeg
https://forums.gentoo.org/viewtopic-t-989196.html

Yeah, this looks similar way of imposing things, to me. I'm not claiming it. I'm only suspecting it.

And I am hoping for lots of Gentoo users seeing through it, and figuring out they need to rid themselves of impositions and proprietary programs... So I hope Larry's own JDK goes the way the Libav went, who were very aggressive in taking over the FOSS market... Gentoo is back to FFmpeg default.

I'm preparing a program for an incomplete release:
http://www.croatiafidelis.hr/gnu/Flowstamp/
( only old stuff there though, new stuff to be on http://github.com/miroR if I make it to prepare it right so I'm speaking as a, very minor, but still a contributor )

Maybe the users needy of this tip need to know how it looks like, this imposition:

I was doing a:

Code:

# emerge -avtuDN world

and after the list of programs there was the "urge" to go to Larry:

Code:

The following license changes are necessary to proceed:
 (see "package.license" in the portage(5) man page for more details)
# required by virtual/jdk-1.8.0::gentoo
# required by virtual/jre-1.8.0::gentoo
# required by dev-java/log4j-1.2.17::gentoo
# required by dev-java/fec-1.0.4-r1::gentoo
# required by net-p2p/freenet-0.7.5_p1467::gentoo
# required by @selected
# required by @world (argument)
>=dev-java/oracle-jdk-bin-1.8.0.45 Oracle-BCLA-JavaSE

Autounmask changes successfully written.

Would you like to add these changes to your config files? [Yes/No]
 * IMPORTANT: config file '/etc/portage/package.license' needs updating.
 * See the CONFIGURATION FILES section of the emerge
 * man page to learn how to update config files.


And that I didn't like, struggle in vain on my own a little, but eventually understood what I needed to do from this guide.

Thanks again!
_________________
Miroslav Rovis
Zagreb, Croatia
www.CroatiaFidelis.hr
Try refute: rootkit hooks in kernel,
linux capabilities for intrusion? (Linus?)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum