protegeproject / protege

Protege Desktop
http://protege.stanford.edu
Other
1.01k stars 232 forks source link

Can't find Java 7 on a Mac #80

Closed OlivierBaudry closed 9 years ago

OlivierBaudry commented 10 years ago

/Applications/Protege_5.0_beta/run.command ; exit; Exception in thread "main" java.lang.UnsupportedClassVersionError: org/protege/osgi/framework/Launcher : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) logout

[Opération terminée]

matthewhorridge commented 10 years ago

What version of Java are you using? You need to have Java 7 btw.

OlivierBaudry commented 10 years ago

Java 7 mise à jour 65 (build 1.7.0_65-b17) on Mac OS Lion 10.7.5

matthewhorridge commented 10 years ago

o.k. this might not be the same version of java that maven is using. If you open a terminal and type mvn -version what output do you get?

OlivierBaudry commented 10 years ago

I get this: Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) Maven home: /usr/share/maven Java version: 1.6.0_65, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: fr_FR, platform encoding: MacRoman OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac"

matthewhorridge commented 10 years ago

o.k. so maven is actually using Java 6. You therefore need to update your Java home to point to 1.7. In my installation this is at:

/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre
OlivierBaudry commented 10 years ago

So I Install Java 7 with package : jre-7u67-macosx-x64 on Mac Os Lion. On Mac os I open Preferences Systeme, Java, I can read : Version Java 7 mise à jour 67, I can read : 1.7 1.7.0_67 http://java.sun.com/products/autodl/j2se in path: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

So on terminal if I write java -version I obtain 1.6.0_65

How must i do it to install protege?

matthewhorridge commented 10 years ago

There's some confusion here. I thought you were trying to compile Protege (using Maven) - based on the title of the issue, but I've just gone back and read your first post and it seems like you are just trying to run Protege. Sorry about this confusion.

So on terminal if I write java -version I obtain 1.6.0_65

This isn't correct. You need it to read 1.7xxxxxxx e.g.

java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

For some reason installing the JRE does not update the symbolic links to the new JRE on OS X. I would therefore install the JDK rather than the JRE. See here

http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jre.html

for more information. You can get the JDK here

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

OlivierBaudry commented 10 years ago

I can read now : java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

matthewhorridge commented 10 years ago

Glad it's sorted.

OlivierBaudry commented 10 years ago

so it's not poosible to run protege now

OlivierBaudry commented 10 years ago

some errors: /Applications/Protege_5.0_beta/run.command ; exit; Exception in thread "main" java.lang.UnsupportedClassVersionError: org/protege/osgi/framework/Launcher : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

matthewhorridge commented 10 years ago

I can read now : java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

How did you get this information? Did you get it from the terminal window?

OlivierBaudry commented 10 years ago

yes of course

matthewhorridge commented 10 years ago

o.k. thanks for the info. I'm having difficulty figuring out what's going on!

Next question, do you type run.command in the terminal or do you double click on it in the Finder?

OlivierBaudry commented 10 years ago

I double click on it on the finder so i's a same result if I write run.command in terminal

matthewhorridge commented 10 years ago

Sorry, but I'm not too sure what's going on. The last error trace that you posted indicates that you're NOT running java 7, but the java -version info that you posted indicates that you are.

As a double check please do the following and copy and paste what you type and the results into the reply to this please.

Sorry, to be so prescriptive but we need to make sure we are doing the same thing.

This is what mine looks like (I have Protege installed in a slightly different location):

Last login: Fri Aug 15 12:20:16 on ttys001
-bash: /usr/local/etc/bash_completion.d/git-prompt.shexport: No such file or directory
matthewhorridge > cd /Applications/Protege_5/
matthewhorridge > java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
matthewhorridge > ./run.command 
Starting Protege Desktop (Version 5.0.0, Build = beta-15)
Platform:
    Java: JVM 1.7.0_51-b13 Memory: 466M
    Language: en, Country: GB
    Framework: Apache Software Foundation (1.5)
    OS: macos (10.9.2)
    Processor: x86-64
Plugin: Cajun Visualization Library (1.0.2)
Plugin: Pellet Reasoner Plug-in (2.2.0)
Plugin: Guava: Google Core Libraries for Java (17.0.0)
Plugin: JFact Plug-in 1.0 (1.0.0)
Plugin: DL Query (1.1.4)
Plugin: OPPL (1.5.5)
Plugin: OWLViz (4.1.4)
Plugin: OWL Code Generation Plug-in (1.0.2)
Plugin: OWL Difference (4.1.1)
Plugin: Protege Editor OWL (5.0.0.beta-15)
Plugin: Protege SPARQL Plugin (1.0.0)
Plugin: Explanation Workbench (1.0.0)
Plugin: Protege HermiT Integration (1.0.0)
Plugin: OntoGraf (1.0.3)
Plugin: OWL Difference Engine (1.0.1)
Plugin: OWLAPI RDF Library (1.0.2)
Plugin: OWLAPI Distribution (3.5.0)
    Cajun Visualization Library Plugin has no plugin.xml resource
    Guava: Google Core Libraries for Java Plugin has no plugin.xml resource
    OWL Difference Engine Plugin has no plugin.xml resource
    OWLAPI RDF Library Plugin has no plugin.xml resource
    OWLAPI Distribution Plugin has no plugin.xml resource
Using OWL API version 3.5.0
Rebuilding entity indices...
... rebuilt in 5 ms
Setting active ontology to OntologyID(OntologyIRI(<http://www.semanticweb.org/matthewhorridge/ontologies/2014/7/untitled-ontology-506>))
Rebuilding entity indices...
... rebuilt in 0 ms
... active ontology changed
Cannot generate ontology catalog for ontology at http://www.semanticweb.org/matthewhorridge/ontologies/2014/7/untitled-ontology-506
Setting active ontology to OntologyID(OntologyIRI(<http://www.semanticweb.org/matthewhorridge/ontologies/2014/7/untitled-ontology-506>))
Rebuilding entity indices...
... rebuilt in 0 ms
... active ontology changed
Auto-update last performed: Fri Aug 15 11:55:46 PDT 2014
Auto-update has not been performed today.  Running it.
OlivierBaudry commented 10 years ago

mbpdeolerbaudry:~ olivierbaudry$ cd /Applications/Protege_5.0_beta mbpdeolerbaudry:Protege_5.0_beta olivierbaudry$ java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode),

-> I dont know which result of first command his different of response in terminal if i write java -version I obtain java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

OlivierBaudry commented 10 years ago

so I retry in a same terminal a simple command java -version mbpdeolerbaudry:~ olivierbaudry$ java -version java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode) mbpdeolerbaudry:~ olivierbaudry$ java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) mbpdeolerbaudry:~ olivierbaudry$

and continue on protege folder like this : mbpdeolerbaudry:~ olivierbaudry$ cd /Applications/Protege_5.0_beta mbpdeolerbaudry:Protege_5.0_beta olivierbaudry$ java -version java version "1.7.0_67" Java(TM) SE Runtime Environment (build 1.7.0_67-b01) Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode) mbpdeolerbaudry:Protege_5.0_beta olivierbaudry$ ./run.command Starting Protege Desktop (Version 5.0.0, Build = beta-15) Platform: Java: JVM 1.7.0_67-b01 Memory: 466M Language: fr, Country: FR Framework: Apache Software Foundation (1.5) OS: macos (10.7.5) Processor: x86-64 Plugin: Cajun Visualization Library (1.0.2) Plugin: Guava: Google Core Libraries for Java (17.0.0) Plugin: DL Query (1.1.4) Plugin: OWLViz (4.1.4) Plugin: OWL Code Generation Plug-in (1.0.2) Plugin: OWL Difference (4.1.1) Plugin: Protege Editor OWL (5.0.0.beta-15) Plugin: Protege SPARQL Plugin (1.0.0) Plugin: Explanation Workbench (1.0.0) Plugin: Protege HermiT Integration (1.0.0) Plugin: OntoGraf (1.0.3) Plugin: OWL Difference Engine (1.0.1) Plugin: OWLAPI RDF Library (1.0.2) Plugin: OWLAPI Distribution (3.5.0) Cajun Visualization Library Plugin has no plugin.xml resource Guava: Google Core Libraries for Java Plugin has no plugin.xml resource OWL Difference Engine Plugin has no plugin.xml resource OWLAPI RDF Library Plugin has no plugin.xml resource OWLAPI Distribution Plugin has no plugin.xml resource Using OWL API version 3.5.0 Rebuilding entity indices... ... rebuilt in 6 ms Setting active ontology to OntologyID(OntologyIRI(http://www.semanticweb.org/olivierbaudry/ontologies/2014/7/untitled-ontology-19)) Rebuilding entity indices... ... rebuilt in 2 ms ... active ontology changed Cannot generate ontology catalog for ontology at http://www.semanticweb.org/olivierbaudry/ontologies/2014/7/untitled-ontology-19 Setting active ontology to OntologyID(OntologyIRI(http://www.semanticweb.org/olivierbaudry/ontologies/2014/7/untitled-ontology-19)) Rebuilding entity indices... ... rebuilt in 2 ms ... active ontology changed Aug 15 22:39:11 mbpdeolerbaudry java[9100] : CGContextGetCTM: invalid context 0x0 Aug 15 22:39:11 mbpdeolerbaudry java[9100] : CGContextSetBaseCTM: invalid context 0x0 Aug 15 22:39:11 mbpdeolerbaudry java[9100] : CGContextGetCTM: invalid context 0x0 Aug 15 22:39:11 mbpdeolerbaudry java[9100] : CGContextSetBaseCTM: invalid context 0x0 Auto-update last performed: Thu Jan 01 01:00:00 CET 1970 Auto-update has not been performed today. Running it.

tudorache commented 10 years ago

OK, so you have both java 1.6 and 1.7 on your machine. We need to make sure that you are using always Java 1.7 for Protege.

The solution is as follows:

Open a terminal, and type: /usr/libexec/java_home -v 1.7

Copy the path that you get back. For example, I get: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home

Then edit the run.sh file in your Protege installation directory. Replace "java" with the full path: add the path from above + "/bin/" before "java", so the java line in run.sh, would look something like:

/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java -Xmx500M -Xms250M

Save run.sh, and run Protege again with run.command, and it should work.

matthewhorridge commented 9 years ago

Closing this as we now bundle Java 8 with the distribution.

artodeschini commented 9 years ago

Try it

  1. Rename \bin\felix.jar to something like felix.jar.bak
  2. Download the latest Felix Framework Distribution (version 3.2.2 worked for me) at http://felix.apache.org/site/downloads.cgi
  3. Extract felix.jar from felix-framework-3.2.2\bin\ inside your downloaded archive file to \bin\felix.jar