Java 1.7 ignored

Archives Forums/MacOS X Discussion/Java 1.7 ignored

Tricky(Posted 2015) [#1]
Until my move to El Capitan (but I already suffered a bit here in Yosemite actually) I used an Lua editor for my Lua scripting, which was based on Eclipse. This was an outdated version, so I downloaded the newest version.

Now when I ran it in El Capitan it says I need to download Java 1.6 and I'm directed to the Apple Page to download it. Installing this and running it results into the editor asking for Java 1.7. I've downloaded this from the Oracle site, but it gets ignored it keeps using Java 1.6 in stead of 1.7.

Now I removed Java completely and only installed 1.7 to make sure the wrong version could not be called. And that leads to OS X to direct me to the Apple page to download 1.6

Of course, I can (if worse comes to worst) settle for 1.6 and keep using an outdated version of this Lua editor (and of Eclipse as a whole for projects in other languages), but I believe there must be a more elegant solution for this, but I could not find any information by googling this. In fact if I look up "Java 1.7 for Mac" Google directs me to.... guess... yep Apple's Java 1.6 page.

At this moment I'm using ZeroBrainStudio for my Lua needs, but that editor lacks too much functionality for my tastes (like an automated parse error checker, the outline is incomplete and so there are a few more issues I find unacceptable), so it's not really the right alternative.

Now I wonder, what can I do to get applications requiring Java 1.7 to run on my Mac. (I mean I don't believe running the Windows version in Wine or a VM is the most proper solution) :P

(EDIT: In the meantime I also tried Java 8, and the problem is still not solved. I can however see "Java" in my control panel and the Java configuration panel just works and says I have Java 8 installed).


Brucey(Posted 2015) [#2]
A quick google search shows answers on the likes of StackOverflow (which happens to be one of the best resources on the internet for programming related issues).

http://stackoverflow.com/questions/12757558/installed-java-7-on-mac-os-x-but-terminal-is-still-using-version-6


Tricky(Posted 2015) [#3]
First of all, thanks for the link, I've been looking for that for ages, however...

The "best" suggestion done on that page (based on the upvotes that is, though the suggestion makes a lot of sense to me too) is to remove "/usr/bin/java" and to replace it with a symlink to the currently installed Java.

Now the big problem stackoverflow doesn't answer is that as of El Capitan Apple made it completely impossible to modify the /usr/bin folder or any of its contents even with the sudo and the su commands this will be denied, making the answer presented in that question page impossible to execute.
Jeroens-Mac-mini:obin Rachel$ sudo rm /usr/bin/java
Password:
rm: /usr/bin/java: Operation not permitted


working with JAVA_HOME was also suggested and for that I copied the name my Java prefences (yes the pane is available in my system settings) and that got me THIS result:
Jeroens-Mac-mini:obin Rachel$ export JAVA_HOME=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
Jeroens-Mac-mini:obin Rachel$ java
Unable to locate an executable at "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java/bin/java" (-1)

The odd part is, though that I did try to run java by calling it directly with that same directory (I copied and pasted it, so typos are impossible) and then it worked....

The answers did bring me to the place where Java 8 had to be located and with that I managed to make eclipse go directly to the java 8 bin file however, now trying to run eclipse gives me THIS error:


Right, my knowledge of Java is not great so I really don't know what to do about THAT one :(


Brucey(Posted 2015) [#4]
when I do :
type java

in terminal, it gives me this :
/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java

Which implies all my virtual machines are located in /Library/Java/JavaVirtualMachines

Listing that dir reveals :
ls /Library/Java/JavaVirtualMachines

1.6.0.jdk	jdk1.7.0_60.jdk


The Java system preferences also indicate that my current version is 1.7_60

Also, java is in my PATH :

echo $PATH

/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin


Presumably that is set via the Java system settings prefs panel thing...

The *last* place I would look for Java is in "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin..."


Tricky(Posted 2015) [#5]
According to ls "/Library/Java/JavaVirtualMachines" is empty on my system.
The "Libraries/Internet Plug-Ins/..." directory is where java is located according to my system preferences panel, and java was installed by an official Java installer and I just used all default settings (If I was even able to alter any settings at all, as I don't remember the installer asking me any).

Oh yeah and the "type" thing, this is what I got:
Jeroens-Mac-mini:JCR Rachel$ type java
java is /usr/bin/java



Brucey(Posted 2015) [#6]
Are you using the JRE as opposed to the JDK?

I always use the JDK, so perhaps that is why mine is different..

Apparently, you can also use /usr/libexec/java_home to set your java home...

export JAVA_HOME=`/usr/libexec/java_home -v 1.7`

then typing "java -version" would show if it changed or not..


Tricky(Posted 2015) [#7]
I shall do one more attempt. (Since all decent alternatives for eclipse require Java as well, GRR!)
Still I do think it's strange, that every program says no version of Java is installed at all, while it IS present.
======== EDIT:
Well, I'll be... Now installing the JDK, which I did before back in Yosemite having the same trouble, and now in El Capitan it magically works.... At least the Eclipse based Lua editor is now asking my General Workspace dir (which it couldn't do without Java)

I still don't know what was going on here, but I'm glad it's fixed.
Thanks, again, Brucey