Building in Eclipse: Difference between revisions

From GLOW Visualization
Jump to navigationJump to search
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Install Eclipse==
==Install Eclipse==


Any vanilla Eclipse can be used (version used: 20090920-1017)
Any modern Eclipse release can be used; it can be downloaded from http://www.eclipse.org/


Add the "plugin development" package:
Add the "plugin development" package:
* Help -> Install new software
* Help -> Install new software
** Work with: Galileo - http://download.eclipse.org/releases/galileo
** Work with: select the current Eclipse release codename, e.g. Galileo, Helios
*** General Purpose Tools
*** General Purpose Tools
**** Eclipse Plug-in Development Environment
**** Eclipse Plug-in Development Environment


==Install the necessary software and libraries==
==Install the necessary software and libraries==


===Get Protege 4.0.x===
First, see [[dependencies for building GLOW]] and install all the dependencies.
* Install it, for example: C:\Program Files\Protege
* Verify that Protege starts up correctly
===Get Prefuse beta===
* URL: http://prefuse.org/download/
* Download Prefuse-beta (release 2007.10.21) source zip
* Unpack it, for example: C:\Program Files\prefuse-beta
* Build it: Go to the prefuse-beta directory and run one of the 'build' scripts
* Doublecheck: sources should now be in: C:\Program Files\prefuse-beta\src\prefuse
 
===Get JOGL===
* URL: http://kenai.com/projects/jogl/pages/Home
* Download URL: http://download.java.net/media/jogl/builds/archive/jsr-231-2.0-beta10/
* Currently using 2.0-beta10
* Unpack it, for example: C:\Program Files\JOGL
* Doublecheck: lots of jar files should now be in: C:\Program Files\JOGL\lib
* Put its 'lib' folder in the system PATH environment variable, e.g.: C:\Program Files\JOGL\lib


===Get a version of GLOW===
While GLOW will run on JDK 1.6, it is advised to compile using JDK 1.5. This ensures that the same class libs are available that are bundled with Protege. To add the JDK 1.5 to Eclipse, do the following:
* URL: http://www.glowvis.org/latest/
* Preferences > Java > Installed JREs > Add...
* Save the .jar files to your Protege 'plugins' directory, e.g. C:\Program Files\Protege\plugins
** JRE home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
* Verify that Protege starts up correctly
** JRE name: J2SE 1.5.0
** Finish


==Make a new Eclipse workbench==
==Make a new Eclipse workbench==
Line 43: Line 26:
==Import necessary OSGI bundles as dependencies==
==Import necessary OSGI bundles as dependencies==


===Import Protege's own plug-ins===
You need this to develop Protege plugins. If you 'run' a plug-in project, Eclipse will start Protege. For more info, see [http://protegewiki.stanford.edu/index.php/CompileProtege4InEclipse].


You need this to develop Protege plugins. If you 'run' a plug-in project, Eclipse will start Protege. For more info, see [http://protegewiki.stanford.edu/index.php/CompileProtege4InEclipse].
===Import Protege core bundles===


File -> Import -> Plug-in Development -> Plug-ins and Fragments
File -> Import -> Plug-in Development -> Plug-ins and Fragments
Line 54: Line 37:
* Next
* Next
* Select:
* Select:
** org.protege.editor
** org.protege.common
** org.semanticweb.owl.owlapi
** org.protege.editor.core.application
** jogl-osgi
* Finish
* Finish


NOTE:
===Import Protege plug-ins===
* Remove 'org.glowvis' and 'org.glowvis.protege' plug-ins if they are present. We want to use them as real source projects and not as dependencies, because they are expected to change a lot.
 
===Import Protege core bundles===


File -> Import -> Plug-in Development -> Plug-ins and Fragments
File -> Import -> Plug-in Development -> Plug-ins and Fragments


* Directory: C:\Program Files\Protege\bundles
* Directory: C:\Program Files\Protege\plugins
* Plug-ins and Fragments to Import: Select from all plug-ins
* Plug-ins and Fragments to Import: Select from all plug-ins
* Import as: binary projects
* Import as: binary projects
* Next
* Next
* Select:
* Select:
** org.protege.common
** org.protege.editor.owl
** org.protege.editor.core.application
** org.semanticweb.owl.owlapi
** jogl-osgi
** prefuse-osgi
* Finish
* Finish
NOTE:
* Remove 'org.glowvis' and 'org.glowvis.protege' plug-ins if they are present. We want to use them as real source projects and not as dependencies, because they are expected to change a lot.


==Create the projects==
==Create the projects==
Line 92: Line 76:
* Version: 1.0.0.qualifier
* Version: 1.0.0.qualifier
* Name: GLOW
* Name: GLOW
* Execution Environment: J2SE-1.5
* Don't generate activators
* Next
Third page:
* Don't use templates
* Finish
In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse at the bottom of this file. On Windows, make sure that backslashes are escaped.
Example:
prefuse.home=C:\\Program Files\\prefuse-beta
jogl.home=C:\\Program Files\\JOGL
protege.home=C:\\Program Files\\Protege
Configure building. In the plug-in overview (main screen), go to the "Build" tab.
* Binary Build: select the following items and deselect the others:
** META-INF
** bin
===org.glowvis.owlapi===
"org.glowvis.owlapi" contains an adapter between OWLAPI and GLOW.
Go to: File -> New Project -> Plug-in Development -> Plug-in Project
First page:
* Project name: org.glowvis.owlapi
* Location: checkout_dir\dev\org.glowvis.owlapi (browse to the checked-out source directory)
* Target Platform: an OSGi framework: Equinox
* Next
Second page:
* Version: 1.0.0.qualifier
* Name: GLOW OWLAPI plugin
* Execution Environment: J2SE-1.5
* Don't generate activators
* Don't generate activators
* Next
* Next
Line 99: Line 118:
* Finish
* Finish
In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse here. On Windows, make sure that backslashes are escaped.
In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse at the bottom of this file. On Windows, make sure that backslashes are escaped.
Example:
Example:
  prefuse.home=C:\\Program Files\\prefuse-beta
  prefuse.home=C:\\Program Files\\prefuse-beta
Line 118: Line 137:
First page:
First page:
* Project name: org.glowvis.protege
* Project name: org.glowvis.protege
* Location: checkout_dir\dev\org.glowvis.protege (browse to the checked-out source directory)
* Target Platform: an OSGi framework: Equinox
* Target Platform: an OSGi framework: Equinox
* Next
* Next
Line 124: Line 144:
* Version: 1.0.0.qualifier
* Version: 1.0.0.qualifier
* Name: GLOW Protege plugin
* Name: GLOW Protege plugin
* Execution Environment: J2SE-1.5
* Don't generate activators
* Don't generate activators
* Next
* Next
Line 131: Line 152:
* Finish
* Finish


In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse here. On Windows, make sure that backslashes are escaped.
In the plug-in overview (main screen), go to the "Overview" tab. Select the checkbox "This plug-in is a singleton".
 
In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse at the bottom of this file. On Windows, make sure that backslashes are escaped.
Example:
Example:
  prefuse.home=C:\\Program Files\\prefuse-beta
  prefuse.home=C:\\Program Files\\prefuse-beta
Line 143: Line 166:
** plugin.xml
** plugin.xml


This project requires Log4j, so do the following:
* In the Package Explorer, rightclick on the project "org.glowvis.protege" and choose Properties
** Click: Java Build Path
** Add JARs, expand the "org.protege.common" bundle, and select the log4j .jar file.
'''Unix/Mac OS X only:''' The linker must know where the JOGL native libraries (.so files) are.
* In the Package Explorer, rightclick on the project "org.glowvis.protege" and choose Properties
** Click: Run/Debug Settings.
** Go to the "Environment" tab.
** Add a "New" environment variable.
*** Name: <tt>LD_LIBRARY_PATH</tt> (for Unix) or <tt>DYLD_LIBRARY_PATH</tt> (for OS X)
*** Value: <tt>/path/to/JOGL/lib</tt>, e.g. /Applications/JOGL/lib or /usr/local/jogl/lib


==Run the Protege plug-in from Eclipse==
==Run the Protege plug-in from Eclipse==
Line 154: Line 189:
If the plug-in does not work and you receive an error message about 64 bit vs 32 bit architecture, it might be that Eclipse is using a JVM that does not match the installed JOGL libraries. In this case:
If the plug-in does not work and you receive an error message about 64 bit vs 32 bit architecture, it might be that Eclipse is using a JVM that does not match the installed JOGL libraries. In this case:


* Right click on the 'org.glowvis.protege' project in the Package Explorer
* Right click on the 'org.glowvis.protege' project in the Package Explorer; select "Properties" from the pop-up menu.
* go to Run/Debug Settings
* go to Run/Debug Settings
* go to the Settings tab
* go to the Settings tab
* choose the correct JRE here, for example, a 64 bit JRE; if Eclipse does not know it, add it.
* choose the correct JRE here, for example, a 64 bit JRE; if Eclipse does not know it, add it.


==Build the plug-ins==
==Build the plug-ins==

Latest revision as of 11:23, 26 May 2011

Install Eclipse

Any modern Eclipse release can be used; it can be downloaded from http://www.eclipse.org/

Add the "plugin development" package:

  • Help -> Install new software
    • Work with: select the current Eclipse release codename, e.g. Galileo, Helios
      • General Purpose Tools
        • Eclipse Plug-in Development Environment

Install the necessary software and libraries

First, see dependencies for building GLOW and install all the dependencies.

While GLOW will run on JDK 1.6, it is advised to compile using JDK 1.5. This ensures that the same class libs are available that are bundled with Protege. To add the JDK 1.5 to Eclipse, do the following:

  • Preferences > Java > Installed JREs > Add...
    • JRE home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
    • JRE name: J2SE 1.5.0
    • Finish

Make a new Eclipse workbench

  • Check out the repository in e.g. a dir 'glow'
  • File -> Switch Workbench -> Other... -> Create a new Eclipse workbench in glow/workspace

Import necessary OSGI bundles as dependencies

You need this to develop Protege plugins. If you 'run' a plug-in project, Eclipse will start Protege. For more info, see [1].

Import Protege core bundles

File -> Import -> Plug-in Development -> Plug-ins and Fragments

  • Directory: C:\Program Files\Protege\bundles
  • Plug-ins and Fragments to Import: Select from all plug-ins
  • Import as: binary projects
  • Next
  • Select:
    • org.protege.common
    • org.protege.editor.core.application
  • Finish

Import Protege plug-ins

File -> Import -> Plug-in Development -> Plug-ins and Fragments

  • Directory: C:\Program Files\Protege\plugins
  • Plug-ins and Fragments to Import: Select from all plug-ins
  • Import as: binary projects
  • Next
  • Select:
    • org.protege.editor.owl
    • org.semanticweb.owl.owlapi
    • jogl-osgi
    • prefuse-osgi
  • Finish

NOTE:

  • Remove 'org.glowvis' and 'org.glowvis.protege' plug-ins if they are present. We want to use them as real source projects and not as dependencies, because they are expected to change a lot.

Create the projects

org.glowvis

"org.glowvis" is the main library.

Go to: File -> New Project -> Plug-in Development -> Plug-in Project

First page:

  • Project name: org.glowvis
  • Location: checkout_dir\dev\org.glowvis (browse to the checked-out source directory)
  • Target Platform: an OSGi framework: Equinox
  • Next

Second page:

  • Version: 1.0.0.qualifier
  • Name: GLOW
  • Execution Environment: J2SE-1.5
  • Don't generate activators
  • Next

Third page:

  • Don't use templates
  • Finish

In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse at the bottom of this file. On Windows, make sure that backslashes are escaped. Example:

prefuse.home=C:\\Program Files\\prefuse-beta
jogl.home=C:\\Program Files\\JOGL
protege.home=C:\\Program Files\\Protege

Configure building. In the plug-in overview (main screen), go to the "Build" tab.

  • Binary Build: select the following items and deselect the others:
    • META-INF
    • bin

org.glowvis.owlapi

"org.glowvis.owlapi" contains an adapter between OWLAPI and GLOW.

Go to: File -> New Project -> Plug-in Development -> Plug-in Project

First page:

  • Project name: org.glowvis.owlapi
  • Location: checkout_dir\dev\org.glowvis.owlapi (browse to the checked-out source directory)
  • Target Platform: an OSGi framework: Equinox
  • Next

Second page:

  • Version: 1.0.0.qualifier
  • Name: GLOW OWLAPI plugin
  • Execution Environment: J2SE-1.5
  • Don't generate activators
  • Next

Third page:

  • Don't use templates
  • Finish

In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse at the bottom of this file. On Windows, make sure that backslashes are escaped. Example:

prefuse.home=C:\\Program Files\\prefuse-beta
jogl.home=C:\\Program Files\\JOGL
protege.home=C:\\Program Files\\Protege

Configure building. In the plug-in overview (main screen), go to the "Build" tab.

  • Binary Build: select the following items and deselect the others:
    • META-INF
    • bin

org.glowvis.protege

"org.glowvis.protege" contains the Protege plugin.

Go to: File -> New Project -> Plug-in Development -> Plug-in Project

First page:

  • Project name: org.glowvis.protege
  • Location: checkout_dir\dev\org.glowvis.protege (browse to the checked-out source directory)
  • Target Platform: an OSGi framework: Equinox
  • Next

Second page:

  • Version: 1.0.0.qualifier
  • Name: GLOW Protege plugin
  • Execution Environment: J2SE-1.5
  • Don't generate activators
  • Next

Third page:

  • Don't use templates
  • Finish

In the plug-in overview (main screen), go to the "Overview" tab. Select the checkbox "This plug-in is a singleton".

In the plug-in overview (main screen), go to the "build.properties" tab. Add your paths to Protege, JOGL, and Prefuse at the bottom of this file. On Windows, make sure that backslashes are escaped. Example:

prefuse.home=C:\\Program Files\\prefuse-beta
jogl.home=C:\\Program Files\\JOGL
protege.home=C:\\Program Files\\Protege

Configure building. In the plug-in view (main screen), go to the "Build" tab.

  • Binary Build: select the following items and deselect the others:
    • META-INF
    • bin
    • plugin.xml

This project requires Log4j, so do the following:

  • In the Package Explorer, rightclick on the project "org.glowvis.protege" and choose Properties
    • Click: Java Build Path
    • Add JARs, expand the "org.protege.common" bundle, and select the log4j .jar file.

Unix/Mac OS X only: The linker must know where the JOGL native libraries (.so files) are.

  • In the Package Explorer, rightclick on the project "org.glowvis.protege" and choose Properties
    • Click: Run/Debug Settings.
    • Go to the "Environment" tab.
    • Add a "New" environment variable.
      • Name: LD_LIBRARY_PATH (for Unix) or DYLD_LIBRARY_PATH (for OS X)
      • Value: /path/to/JOGL/lib, e.g. /Applications/JOGL/lib or /usr/local/jogl/lib

Run the Protege plug-in from Eclipse

Open the org.glowvis.protege project.

Go to: Run -> Run (Ctrl-F11)

  • Choose 'OSGi Framework'
  • This should start Protege.

If the plug-in does not work and you receive an error message about 64 bit vs 32 bit architecture, it might be that Eclipse is using a JVM that does not match the installed JOGL libraries. In this case:

  • Right click on the 'org.glowvis.protege' project in the Package Explorer; select "Properties" from the pop-up menu.
  • go to Run/Debug Settings
  • go to the Settings tab
  • choose the correct JRE here, for example, a 64 bit JRE; if Eclipse does not know it, add it.

Build the plug-ins

  • Right click on a project (e.g., 'org.glowvis.protege') in the Package Explorer
  • Export
  • Deployable plug-ins and fragments
  • This produces a single .jar file for the component, which you can place in your Protege plugins directory (e.g., C:\Program Files\Protege\Plugins)