0

I'm trying to compile this example project with Ubuntu 16.04.2 LTS, java, eclipse, maven, tomcat8 but when I finally import the project and try to run this command mvn eclipse:eclipse
I get this error Error: JAVA_HOME is not defined correctly. We cannot execute /usr/lib/jvm/jdk1.8.0_111/bin/java/bin/java

In my /etc/environment directory I already have this line JAVA_HOME="/usr/lib/jvm/jdk1.8.0_111"

My question is different from others that are already posted because, for example, when I do what says here then I get this bash: /usr/libexec/java_home: No such file or directory

Community
  • 1
  • 1
ferpel
  • 206
  • 3
  • 12
  • Could you check what's your java version? – FreedomPride Feb 23 '17 at 01:45
  • java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode) – ferpel Feb 23 '17 at 01:47
  • @Ken White Thank you for the advice, but I already know about that link, I've already tried it, take a look at the "here" link in the last sentence of my posted question – ferpel Feb 23 '17 at 01:50
  • My guess is that somewhere else in your environment, other paths are being incorrectly appended to JAVA_HOME resulting in the value `/usr/lib/jvm/jdk1.8.0_111/bin/java/bin/java` (which seems wrong). – David Choweller Feb 23 '17 at 01:51
  • If you run the following command in a shell, what output do you get? `echo $JAVA_HOME` – David Choweller Feb 23 '17 at 01:55
  • Thanks @David Choweller, can you tell me why is that I have an error in that ...bin/java/bin/java because I tried to browse to that folder and doesn't exist. Also I don't understand what I could do to get that kind of directory. And why the environment archive says another different route? I'm new working with this and need to learn some things yet – ferpel Feb 23 '17 at 01:56
  • Right now after trying some "export" operations (I don't know if that changed something in a wrong way) when I type `echo $JAVA_HOME` it leaves a blank row and does nothing. After that row I have again the current working directory with the cursor to continue typing – ferpel Feb 23 '17 at 01:59
  • The information in that post provides the solution. You'll need to find the proper location on your machine (based on your profile, where you installed it, and the Java version you installed, which no one here can provide because we're not sitting at your keyboard and looking at your screen), and then use the information in the linked post to set the proper location for your particular situation. It's simply not useful to have 400 questions here that are all identical except for the Java version or installation location. You're at the computer. – Ken White Feb 23 '17 at 02:15
  • If you exit the shell and then go back into a new shell, and type `echo $JAVA_HOME`, what output do you get? – David Choweller Feb 23 '17 at 02:15
  • @Ken White sorry, I've tried to participate in already posted questions but I can't since I don't have enough reputation to do it. What should I do to explain further if I can't participate there? – ferpel Feb 23 '17 at 02:34
  • @David Choweller great! If I do that then I get this `/usr/lib/jvm/jdk1.8.0_111` – ferpel Feb 23 '17 at 02:35
  • You don't have to *participate*, just *read*. You're part way there. Now that you see where it's pointing on your machine, does that folder exist? (See? We're having to have **you** work the keyboard and look at the screen, just as I said.) If that folder does *not* exist, then where do you find a `jvm` folder *on your machine beneath `/usr/lib`, and what's in it? – Ken White Feb 23 '17 at 02:40
  • I suspect when you looked at the dupe I linked, you stopped reading at the accepted answer. There are more answers there such as [this one](http://stackoverflow.com/a/36628570/62576), which gives you step-by-step instructions on how to troubleshoot this issue. Did you read and follow those steps? – Ken White Feb 23 '17 at 02:44
  • I tried it, and I have modified the environment variables so they match the current route where java is located but it still tries to find the file in another route. It says "We cannot execute /usr/lib/jvm/jdk1.8.0_111/bin/java" but the true route is with /usr/lib/jvm/jdk1.8.0_121/bin/java. This one, the true, the last one with the 121 number, is the route that is written in the environment – ferpel Feb 23 '17 at 03:15
  • Earlier you said that when you execute the command `echo $JAVA_HOME` in your environment you get the output `/usr/lib/jvm/jdk1.8.0_111`, but now you're saying that "the last one with the 121 number, is the route that is written in the environment." I'm confused. – David Choweller Feb 23 '17 at 03:19
  • @David Choweller When I browse the folders myself I see that is 121 but when I write in the terminal the `echo $JAVA_HOME` it says it's the 111 route. The /etc/environment file is written with the 121 routes – ferpel Feb 23 '17 at 03:24
  • When you posted originally you said "In my /etc/environment directory I already have this line JAVA_HOME="/usr/lib/jvm/jdk1.8.0_111" Now you're saying "The /etc/environment is written with the 121 routes." I'm confused. – David Choweller Feb 23 '17 at 03:30
  • Sorry I didn't explain that part. I changed the /etc/environment to match the real directory that I've been browsing for myself. I don't know where's the other configuration that keeps the old setting – ferpel Feb 23 '17 at 12:08

0 Answers0