Professional Documents
Culture Documents
Table of Contents
Quick start
Install the needed tools
Configure Tomcat
Start Tomcat
Start Eclipse
Execute the example application
Add another class
Add a teacher reference to pupil
Show teacher reference as a combo
Add a collection of pupils to teacher
Create your own project
Quick start
Also available in Spanish.
Go to http://www.oracle.com/technetwork/java/javase/downloads/index.html
Download the latest JDK. OpenXava works with Java 8, 7 and 6. (Don't use Java 9 or 10)
Install it. Remember the path where you install the JDK, you'll need it to configure Tomcat in
the next section.
Download and install Eclipse (if not yet installed):
Go to http://www.eclipse.org/downloads/eclipse-packages
Download 'Eclipse IDE for Java EE Developers'.
Install it.
Configure Tomcat
You have to indicate Tomcat where you have installed the JDK.
With Windows, add the next line at the beginning of catalina.bat in tomcat\bin folder:
Don't put C:\Program Files\Java\jdk1.8.0_45 put the real path where the JDK is installed in your
system.
With Linux or Mac, add the next line at the beginning of catalina.sh in tomcat/bin folder:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 1/10
11/2/2018 openxava - quick-start_en
Don't put /usr/lib/jvm/java-8-openjdk put the real path where the JDK is installed in your system.
Start Tomcat
Start Tomcat, with Windows just double click on startup.bat of tomcat\bin:
If you use Linux or Mac run startup.sh located in the tomcat/bin folder of OpenXava:
Start Eclipse
Start Eclipse, it will ask you to choose the workspace, choose the one included in OpenXava:
If you already have Eclipse started use the option File >Switch Workspace. If you're using an old
version of Eclipse it will ask you "Workspace ... was written with a newer version of the product and
can be incompatible with this version. If you continue, this can cause unexpected behavior or data
loss", don't worry, just click on OK.
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 2/10
11/2/2018 openxava - quick-start_en
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 3/10
11/2/2018 openxava - quick-start_en
package org.openxava.school.model;
import javax.persistence.*;
import org.openxava.annotations.*;
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 4/10
11/2/2018 openxava - quick-start_en
@Entity
public class Pupil {
@Column(length=40) @Required
private String name;
Go to http://localhost:8080/MySchool/modules/Pupil to see Pupil in action (if it asks for sign in, use
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 5/10
11/2/2018 openxava - quick-start_en
...
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 6/10
11/2/2018 openxava - quick-start_en
Deploy it:
...
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 7/10
11/2/2018 openxava - quick-start_en
@ManyToOne
private Teacher teacher;
...
Go to http://localhost:8080/MySchool/modules/Pupil :
...
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 8/10
11/2/2018 openxava - quick-start_en
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 9/10
11/2/2018 openxava - quick-start_en
Go to http://localhost:8080/MySchool/modules/Teacher :
http://www.openxava.org/OpenXavaDoc/docs/quick-start_en.html 10/10