Recently apt-get install -y oracle-java7-installer stopped working.
I know in their roadmap, I think the public version is no longer supported, but it's been working all the way until recently.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Anyone have a work around for this?
http://download.oracle.com/otn-pub/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz?AuthParam=1495560077_4041e14adcb5fd7e68827ab0e15dc3b1
Connecting to download.oracle.com (download.oracle.com)|96.6.45.99|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-05-23 10:19:17 ERROR 404: Not Found.
It appears Oracle has moved the download link, you can still fetch the tar ball from the oracle website after jumping through some hoops. The WebUpd8 installer is currently broken. The official explanation can be found at http://www.webupd8.org/2017/06/why-oracle-java-7-and-6-installers-no.html
Download Method 1: Login into to Oracle site
The link now seems to be: http://download.oracle.com/otn/java/jdk/7u80-b15/jdk-7u80-linux-x64.tar.gz
notice "otn" and not "otn-pub", but at least from the website you seem to need to be signed in and not only accept the license agreement.
It may be possible with debconf to change the url from otn-pub to otn and get the installer to work but I haven't tried. You can fetch the binary yourself and either install manually or with the installer pointing it to wherever you put the downloaded tar ball.
Edit: It seems there isn't a way to configure download URL (though you can hijack it with hosts as in another answer).
Download Method 2: Use a trusted mirror
If you want to download jdk-7u80-linux-x64.tar.gz from a script without logging into to oracle it hosted locations include:
http://ftp.osuosl.org/pub/funtoo/distfiles/oracle-java/
http://ftp.heanet.ie/mirrors/funtoo/distfiles/oracle-java/
EDIT: The sha256 has been removed from this answer because (as this edit demonstrates) anyone can edit said hash. Get your hashes from a trusted source. Suggestions include:
https://www.oracle.com/webfolder/s/digest/7u80checksum.html
Install Method 1: Prepopulate cache
#put the file in the default cache location:
sudo mv jdk-7u80-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
#then install normally:
sudo apt-get install oracle-java7-installer
Install Method 2: (more elegant IMHO) put tar ball anywhere and tell the installer where to look
#setup ppa (you probably came here after already doing this)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
#put the file in a temporary location:
sudo mv jdk-7u80-linux-x64.tar.gz /tmp/
#set local path to /tmp (or any other path)
echo oracle-java7-installer oracle-java7-installer/local select /tmp | \
sudo /usr/bin/debconf-set-selections
#While your at it you may want tp approve license (or skip this and approve when prompted)
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | \
sudo /usr/bin/debconf-set-selections
#then install normally:
sudo apt-get install oracle-java7-installer
So looks like the direct links to the download no longer work( As noted by Meir Maor above)
Here are the steps to get this running again:
Go to http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html and accept the license. Download the file we need (jdk-7u80-linux-x64.tar.gz in this case)
Assuming the file downloaded to your Downloads directory, we need to move it to /var/cache/oracle-jdk7-installer
cd ~/Downloads (Change to directory to which you saved file from step 1)
sudo mkdir /var/cache/oracle-jdk7-installer
sudo mv jdk-7u80-linux-x64.tar.gz /var/cache/oracle-jdk7-installer/
Not sure if necessary but I had luck with this:
echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
Run the installer now. It will use the file we saved in /var/cache instead of trying to download it from Oracle
sudo apt-get install oracle-java7-installer
I got step 3 from http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
I just ran into this trying to install Java 6 (don't ask).
Since I'm short on time, I was fine with a quick and dirty answer. I noticed the URL looked for by the installer was http-based (vs https), which makes the below solution possible.
Make sure a web server is installed (I already had Apache on my box)
Download the file that is requested. In your case that is
jdk-7u80-linux-x64.tar.gz. See Meir Maor's answer above
On your local web server, recreate the path structure requested for the
file. In your case that is otn-pub/java/jdk/7u80-b15.
Copy the downloaded file into the path above
Edit /etc/hosts and add 127.0.0.1 download.oracle.com
Run apt-get install -y oracle-java7-installer again.
The installer will now grab the file from your local web server and complete successfully.
There may be a better way to do this, but it worked for me.
As Oracle support for debian packages has gone quite a while ago, I suppose that you use the method of webupd8
Go to their instructions I linked before and check if your configuration is still valid.
They also provide a method to install Java 8: Install Oracle Java 8 in Ubuntu (Debian instructions linked from there.)
Edit: I think that Oracle does not provide a public download of Java 7 anylonger - you would have to download it from the Java Archive. (http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html)
You could try to download the rpm package and use alien to convert it to a .deb package. And did you already consider updating to Java 8?
You can find the webupd8team ppa's online. The oracle-java7-installer has the version number "7u80+7u60arm-0~webupd8~1" I'm guessing this defect would occur for all the provided ubuntu versions!
Looking in one of the ppa's a few of the files directly reference the broken url identified by Meir Maor
debian/oracle-java7-unlimited-jce-policy.postinst:PARTNER_URL=http://download.oracle.com/otn-pub/java/jce/7/$FILENAME
debian/oracle-java7-unlimited-jce-policy.config:PARTNER_URL=http://download.oracle.com/otn-pub/java/jce/7/$FILENAME
debian/oracle-java7-installer.config: PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u80-b15/$FILENAME # Must be modified for each release!!!
debian/oracle-java7-installer.config: PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u60-b19/$FILENAME # Must be modified for each release!!!
debian/oracle-java7-installer.postinst: PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u80-b15/$FILENAME # Must be modified for each release!!!
debian/oracle-java7-installer.postinst: PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/7u60-b19/$FILENAME # Must be modified for each release!!!
unfortunately I can't figure out how to lodge a defect with them (yet) but presumably this would be a quick fix
Related
First time I try to install Pentago by using this link.
I summarize that, so far what I done from the given link.
PART- I JAVA (Open - JDK)- Installation
To install Java,
apt-get install openjdk-7-jre
apt-get install openjdk-7-jdk
Open .bashrc file using an nano editor. And following lines are added at the mid of file. Becaues ther aren't mention the location need to be paste
JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21/
export JAVA_HOME
PART- II Pentaho 5.0.1 CE installation
mkdir /home/folder1/pentaho
cp //windowspath/biserver-ce-5.0.1-stable.zip /home/folder1/pentaho/
unzip file under pentaho
./start-pentaho.sh
./stop-pentaho.sh
Then, finally I generate following link:
http://ip.addr.of.server:8080/pentaho/
But it shows me an error. I need your help for get home page of Pentaho.
Linux OS version:
NAME="Ubuntu"
VERSION="12.04.5 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04.5 LTS)"
VERSION_ID="12.04"
wget Error:
--2019-09-24 08:17:20-- http://sourceforge.net/projects/pentaho/files/Business
Resolving sourceforge.net (sourceforge.net)... 216.105.38.13
Connecting to sourceforge.net (sourceforge.net)|216.105.38.13|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://sourceforge.net/projects/pentaho/files/Business [following]
--2019-09-24 08:17:20-- https://sourceforge.net/projects/pentaho/files/Business
Connecting to sourceforge.net (sourceforge.net)|216.105.38.13|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-09-24 08:17:21 ERROR 404: Not Found.
--2019-09-24 08:17:21-- http://intelligence/
Resolving intelligence (intelligence)... failed: Name or service not known.
wget: unable to resolve host address `intelligence'
--2019-09-24 08:17:21-- http://server/5.0.1-stable/biserver-ce-5.0.1-stable.zip/
Resolving server (server)... failed: Name or service not known.
wget: unable to resolve host address `server'
I found this link with same error. But not during installing. And forums.pentaho is not opening with 502 Bad Gateway error.
Note:
This is my step for install Pentaho.
I installed Java like reference link.
The zip is manually downloaded in Windows and moved to /home/folder1/pentaho/. Using mount command.
Versions:
Pentaho:
The file is biserver-ce-5.0.1-stable.zip. So version may be 5.0.1.
Java:
openjdk version "1.8.0_222-ea"
OpenJDK Runtime Environment (build 1.8.0_222-ea-8u222-b05-1~12.04.1-b05)
OpenJDK 64-Bit Server VM (build 25.222-b05, mixed mode)
I can't give you a complete answer on how to do this, as the software version you're trying to run is so old it's hard to find the packages, likely to break other stuff on my machine and insecure as well.
Before spending more time, you should really verify that you absolutely need this version and cannot use a newer one. The newer ones are a lot easier to install. Just verify/install Java, unzip and run start-pentaho.sh
The way to get the old Pentaho to work is to really double check EVERY step.
It's very likely that apt-get install openjdk7-xxx fails because there are few repositories that still have it. Check again if the packages are installed correctly.
Double check that the path to the jdk is correct. Try to run java -version from that directory to verify the version. It must say "1.7.xx"
The JAVA_HOME is probably in your .bashrc, not that of the user pentaho. Check it. Even better, go and hack the start-pentaho.sh script and set it there, just before the actual call to start tomcat server.
CD to pentaho-server folder and run ./start-pentaho.sh Check the logging output to the console window and tomcat/logs/catalina.out for errors and try to solve them.
If the server manages to start up, go to the url and see what happens. Check the output in the console window.
I have installed SDKMAN! as root on my server and want all my users (developers) to have access to it.
For that I did:
export SDKMAN_DIR="/usr/local/sdkman" && curl -s "https://get.sdkman.io" | bash
source "/usr/local/sdkman/bin/sdkman-init.sh"
Then for a user, I added these lines at the end of .profile and .bashrc:
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/usr/local/sdkman"
[[ -s "/usr/local/sdkman/bin/sdkman-init.sh" ]] && source "/usr/local/sdkman/bin/sdkman-init.sh"
From that user (non root), the sdk command works, but when I try to install Java, I get a lot of errors for folders and files permissions, that's OK because most of those where created by root, not by my current user.
Then I try:
sudo sdk install java 9.0.4-open
And got:
sudo: sdk: command not found
Not sure what I'm doing wrong, maybe I need to install SDKMAN! for each user on my server, which would be a pain.
Any suggestions?
It seems it is not possible to install SDKMAN! once as root and that be available for all users. I guess each user needs to install it and then each users needs to install it's own version of Java, which is a pain if I manage one server and need several users to have the same configuration.
I've read a lot of troubleshooting for similar occurrences of this error, but what is causing it for this particular .jar?
https://download.cnet.com/android/nabin-bhandari/3260-20_4-10982661-1.html
It works on Windows, but when attempting to run the file on a raspbian (linux) system running java version 1.8.0_65 with the command java -jar Local\ Area\ Messenger\ Desktop.jar it throws the error about not being able to find or load the main class.
The MANIFEST.MF defines Main-Class: com.nabinbhandari.lam.Main and there doesn't appear to be any issues with case sensitivity.
What am I missing? Do I need to install something more than Java Runtime Environment?
Edit: In case it is not clear, I am not the developer of this file. I am simply a user trying to run the file. This question has nothing to do with Eclipse and I don't understand why people are linking to that other question. I am not running Eclipse. Please stop linking to that. Please examination the .jar file I have provided.
Edit 2: I have followed the instructions and in this answer:
https://stackoverflow.com/a/1238173/2407742
It gives the error no main manifest attribute, in test.jar
Is there something missing from my java runtime environment? It seems like nothing works.
The Local Area Network Messenger application was developed using JavaFX, which is not included in the Oracle Java build for Rasperry Pi. I had to reinstall Java and then openjfx by doing the following:
sudo apt-get purge openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre
sudo apt-get install openjfx
It runs fine now.
The solution to this was the following:
Close Eclipse/STS
Use a file explorer on your operating system to navigate to your workspace (In my case, I'm on Windows so I used Windows Explorer)
Delete the .metadata directory (or to be safe, copy the directory somewhere else to be safe, then delete it)
Restart Eclipse/STS
Is there a more improved answer than this? I don't want to look like I'm trying to boost my own reputation points, so if someone can provide a better answer then please do so.
Please excuse what appears to be a question answered before, but if I read 10 different posts I find 20 different responses.
I just installed Fedora 25. I am going to be learning Java development and need to set up my environment. I will be using openjdk and have installed java-1.8.0-openjdk-devel. I will also be using Maven.
Now I need to set my $PATH and $JAVA_HOME variables.
I tried the answer found here (Fedora OpenJDK Set JAVA_HOME)
but after adding to my .bashrc
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
and then testing, I get what appears to me to be the wrong answer because I do not think there should be a /jre/ on the end
> echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-1.b14.fc25.x86_64/jre/
So can I please ask what I should set JAVA_HOME to so that I do not need to update it with every openjdk update?
After that I think PATH is just
export PATH=$JAVA_HOME/bin:$PATH
this seems like such a straightforward thing to do yet it seems to me there is much confusion. thx
PS
also, is .bashrc even the correct place? because I see here (https://askubuntu.com/questions/175514/how-to-set-java-home-for-java) that /etc/environment would be more appropriate) thx
I suggest create an alias command, modifying bashrc and set JAVA_HOME
into bash_profile, this:
Create command in the bashrc:
alias set-java='sudo alternatives --config java;export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::");source ~/.bash_profile'
Save and execute: source ~/.bashrc
Create generic JAVA_HOME in bash_profile:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
PATH=$JAVA_HOME/bin:$PATH
Execute the alias command
Set JAVA_HOME :
echo "JAVA_HOME=/etc/alternatives/jre" >> ~/.profile
source ~/.profile
echo $JAVA_HOME
I put the following in ~/.profile, not ~/.bashrc and I think it's the same on Fedora (I used CentOS at work and do the same):
export JDK_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export JAVA_HOME=$JDK_HOME/jre
I have to either sign out or reboot after changing .profile.
On Ubuntu, java only changed from 7 to 8 a few years ago. I don't know why Fedora would want to put an exact version number on the java folder. You might complain?
If Java moves around too much for you on Fedora, use a symlink. The symlink takes affect right away, without logging out or rebooting. On my laptop, I encrypt my home folder, so for extra speed, I put most third party tools in a /tools/ folder and give myself account access to it (sudo chown -R myself.myself /tools/ where myself is my user ID). That's where I put my maven install. Tomcat uses a different directory name for each release, so I make a symlink like so:
cd /tools
ln -s apache-tomcat-8.0.38 latest-tomcat
Then in ~/.profile (CATALINA means TOMCAT in this example - don't ask me why):
# My un-encrypted Tools folder
export TOOLS=/tools
# Tomcat
export CATALINA_HOME=$TOOLS/latest-tomcat
# Maven
export M2_HOME=$TOOLS/apache-maven-3.3.9/
export M2="$M2_HOME"bin
export PATH=$PATH:$M2
When I upgrade tomcat:
cd /tools
rm -f latest-tomcat
ln -s apache-tomcat-8.0.39 latest-tomcat
You can use the same technique to make a /usr/lib/jvm/latest-java. In fact, if you install Oracle Java (not necessarily recommended), it does exactly that, for this reason.
Yes, what you said about the path looks correct to me. I don't put java in my path, preferring to use $JDK_HOME, $JAVA_HOME, or just calling maven. Part of that is for security. Part of it is to feel like I always know which version of Java I'm using.
P.S. To me, the ln -s syntax always looks as if the arguments are reversed. The actual folder name goes first, followed by your desired alias/link.
OpenJDK bundled with Fedora dosen't work for me. For example IntelliJ can't use this version. In my opinion, best option is to install Oracle JDK RPM from Oracle.
JDK location:
/usr/java/latest/
To manipilate JRE use command below:
sudo alternatives --config java
So far, this gets Android Studio running using the Fedora provided OpenJDK and respects the distribution provided materials without a bunch of otherwise unmanaged symlinking:
vim ~/.bash_profile
Add the following, or replace any existing examples that look similar to it:
export JAVA_HOME=$(readlink -f /usr/bin/java | cut -d/ -f1-6)
The command basically asks for the physical path that the symlink /usr/bin/java points to (configured by alternatives in Fedora), and then says "take the first 6 fields given to you by splitting on the / character."
Note that your $PATH will already be set up correctly for use with the Fedora provided OpenJDK.
In practice, this ends up looking like:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-8.fc28.x86_64/jre
This assumes you have at least one of the OpenJDK packages Fedora ships. 25 probably only shipped 1.8, 28 ships 1.8, 10.0.2, and 11.0.1. (if you're reading this and still using 25, it's probably time to upgrade.)
Install one of the java-*-openjdk-headless packages available to you (or one of the Oracle provided ones), and configure which one to use using:
sudo alternatives --config java
The default on my Fedora 28 install was to use OpenJDK 1.8.
Sadly I don't have Fedora available for me, so I can't investigate how Java is usually installed, but why you don't try to replace /usr/bin/java in your expression with something like /usr/bin/javac? The actual path to javac link you can get with
which javac
And read the real path with readlink. Obviously, it works if JDK is installed (not JRE).
About updating, most of Linux distros create a symbolic link like /usr/lib/jvm which is set to the correct directory and update in case of new version. For me better solution it to put this path in your bashrc.
And yes, bashrc is usually enough if you don't need JAVA_HOME to be visible to other OS users.
Maybe adding a tr could work? export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::" | tr -d "/jre/") ?
Also, setting it in your env var will make the var independent from the sh your using. That's a great way to store It.
Typing cd /usr/lib/jvm from shell I see the following:
default-java java-1.6.0-openjdk-i386 java-6-openjdk-common
java-1.5.0-gcj-4.6 java-1.7.0-openjdk-i386 java-6-openjdk-i386
java-1.6.0-openjdk java-6-openjdk java-7-openjdk-i386
can someone explain what's the difference between java-1.x.. and java-x-openjdk folders?
More specifically, when I want to set default jdk in Netbeans or Eclipse, which folders should I use out of those two types?
Although I cannot tell for sure, but I suspect that all the java-6-* are soft links to java-1.6.0-openjdk-i386. Likewise, all the java-7-* are soft links to java-1.7.0-openjdk-i386.
If you want to tell for sure, do ls -l so you can see the details of the files, including what they are links to.
If you still need Java 5, 6 and 7 (even though they are EOL) then you can add any of the paths (linked or not) to Eclipse.
As for which should be your default, install Java 8 and set that up as the default. The best way on Ubuntu is probably this way (see docs):
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer