LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Java install: JAVA_HOME seems to be missing (https://www.linuxquestions.org/questions/slackware-14/java-install-java_home-seems-to-be-missing-4175614397/)

deretsigernu 09-23-2017 09:10 PM

Java install: JAVA_HOME seems to be missing
 
Hi, I used the instructions from here:

https://docs.slackware.com/howtos:software:java

I got the latest version for linux from Oracle's website. The version I downloaded is jdk-9_linux_x64_bin.tar.gz and with java.SlackBuild it was turned into jdk-9_linux-i586-1.txz. The install doesn't seem to have worked correctly. The java website to test the install doesn't detect java.

I am trying to install another software with sbopkg and it looks for java as a dependency, but there is an error about java missing.

The instructions from the referenced link say that JAVA_HOME is /usr/lib64/java, but I don't have anything like that:
Code:

find /usr -name java
Quote:

/usr/lib64/R/share/java
/usr/lib64/jvm/bin/java
/usr/lib64/jvm/jre/bin/java
/usr/lib64/gcc/x86_64-slackware-linux/4.8.2/plugin/include/java
/usr/doc/gcc-4.8.2/gcc/java
/usr/doc/swig-2.0.10/Examples/python/java
/usr/doc/swig-2.0.10/Examples/test-suite/java
/usr/doc/swig-2.0.10/Examples/tcl/java
/usr/doc/swig-2.0.10/Examples/perl5/java
/usr/doc/swig-2.0.10/Examples/ruby/java
/usr/doc/swig-2.0.10/Examples/java
/usr/doc/libidn-1.33/contrib/java
/usr/lib/java
/usr/lib/java/bin/java
/usr/share/swig/2.0.10/java
/usr/share/java
/usr/include/c++/4.8.2/gnu/java
/usr/include/c++/4.8.2/java
How do I fix this?

bassmadrigal 09-23-2017 09:12 PM

You need to log out and then log back in. It should hopefully run the profile script that will set the java variables.

Richard Cranium 09-24-2017 12:28 AM

Quote:

Originally Posted by deretsigernu (Post 5762164)
The java website to test the install doesn't detect java.

That requires the java plugin to be enabled on your browser for earlier versions of java (8 and earlier); even then, the plugin isn't normally enabled by default. IIRC, JDK9 doesn't include the plugin at all.

JDK 9 does things differently than earlier versions; you'll probably have some issues compiling and/or running various java programs with it. Given that JDK 9 was released only 3 days ago, I'd suggest that you start with the latest version of JDK 8 for now.

deretsigernu 09-24-2017 12:45 PM

bassmadrigal, I restarted then tried to check the java variables and the website and nothing was different. I think that Richard Cranium might be on to something. I will see if I can uninstall this and use JDK 8 instead.

FTIO 09-24-2017 01:13 PM

I've always used this command to make sure that my browsers use/see it...

EXPLOIT_ME=YES ./jdk.SlackBuild

Bleh, never mind. I just looked at it and it isn't setup the same at all as the 8 series. We're just gonna have to wait for one ot the smarter minds that knows how to do so to make the new SlackBuild for this new series.

bassmadrigal 09-24-2017 02:26 PM

Quote:

Originally Posted by deretsigernu (Post 5762387)
bassmadrigal, I restarted then tried to check the java variables and the website and nothing was different. I think that Richard Cranium might be on to something. I will see if I can uninstall this and use JDK 8 instead.

Yeah, if this is the case, then it is likely that JDK9 uses a different setup than JDK8 and the SlackBuild would need tweaking to get it to work properly.

JDK8 is pretty well supported, so hopefully you can use that without issue.

But as others have mentioned, the SlackBuild does disable the java plugin by default because there are a lot of possible attack vectors with it. If you really need it, you need to run the SlackBuild with EXPLOIT_ME=YES jdk.SlackBuild, to hopefully let you know that the chances of being exploited with it are high and it is not recommended. If you are just using the website to check if your java is installed, it isn't worth it to install the java plugin. All you need to do to verify java is installed is run java. If it comes back with an error message, things aren't set up as they should be. If it dumps the help file, then it's likely installed correctly.

deretsigernu 09-24-2017 02:43 PM

bassmadrigal, thanks for the info. I was not aware of the disabled plugin. I'm going to try v8.x.

deretsigernu 09-24-2017 03:33 PM

bassmadrigal, thanks for the info. I was not aware of the disabled plugin.

I used jdk-8u144-linux-x64.tar.gz from http://www.oracle.com/technetwork/ja...s-2133151.html

I followed the instructions I referenced at start of the thread and I still get:

Code:

bash-4.2$ which java
which: no java in (/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin)

When I ran ./java.SlackBuild, there were several lines of output similar to

Quote:

WARNING: zero length file usr/lib64/java/lib/security/trusted.libraries
but for several directories, probably a couple of dozen in all.

bassmadrigal 09-24-2017 03:58 PM

Did you log off and then log back on? The program adds a script to your /etc/profile.d/ directory to set up the correct variables, but you need to log off and log back on for it to take effect.

deretsigernu 09-24-2017 04:15 PM

Yes, I logged out and back in.

deretsigernu 09-24-2017 04:17 PM

Yes, I logged out and back in.

/etc/profile.d has no files with java in the name.

bassmadrigal 09-24-2017 04:41 PM

Oh, did you install the package after you ran the SlackBuild? It should be in /tmp/. The SlackBuild doesn't install the packages automatically... it just creates them.

Code:

installpkg /tmp/jdk-8u144-x86_64-1_SBo.tgz
Once installed, it should create a jdk.sh and a jdk.csh file in /etc/profile.d/ amount a lot of other files. You can either source the jdk.sh file or log out and log back in.

deretsigernu 09-24-2017 06:10 PM

Backing up a little bit, at first, instead of
Code:

installpkg
I ran

Code:

upgradepkg --install-new
I went back and uninstalled it and logged out and back in and then used
Code:

installpkg
and logged out and back in and I still get "no" when I use
Code:

which java
, so it seems there a problem somewhere else?

You refer to /tmp/jdk-8u144-x86_64-1_SBo.tgz

So then I noticed the "SBo" in your latest reply.

The file I downloaded was
Quote:

jdk-8u144-linux-x64.tar.gz
and the file output from the java.SlackBuild is
Quote:

jdk-8u144-x86_64-1.txz
So java.SlackBuild is making something a little different for me, no "SBo" as I highlighted from your comment and the file is .txz for me and .tgz for you. Could this be the problem?

bassmadrigal 09-24-2017 06:19 PM

Oh, you're probably using the SlackBuild from extra/. To be honest, I'm not sure if that's been worked for JDK8 and was probably originally designed for JDK7... it's been years since I've used it in favor of the one on SlackBuilds. This one will add the required files into your /etc/profile.d/

https://slackbuilds.org/repository/1...velopment/jdk/

You can simply just download the SlackBuild tarball, extract it, move the jdk file into it and then run that. Once it is done, install that package, replacing the other one.

Code:

wget https://slackbuilds.org/slackbuilds/14.2/development/jdk.tar.gz
tar xvf jdk.tar.gz
mv ../jdk-8u144-linux-x64.tar.gz .
sh jdk.SlackBuild
--wait a bit--
upgradepkg --install-new --reinstall /tmp/jdk-8u144-x86_64-1_SBo.tgz
source /etc/profile.d/jdk.sh
which java

That should provide the expected output.

deretsigernu 09-24-2017 10:43 PM

bassmadrigal, that did it. Thank you very much!


All times are GMT -5. The time now is 01:18 AM.