Objectivity for Java requires that you have access to following software:
Objectivity for Java will be installed on the installDir that you specified.
Add the Objectivity for Java library path:
CLASSPATH installDir\lib\oojava.jarNote: some application development environments such as Visual J++ or Visual Cafe require you to specify CLASSPATH from within the tool.
setenv PATH "/usr/local/libexec/jdk/1.1.6/bin:${PATH}"
setenv CLASSPATH ".:/afs/cern.ch/sw/lhcxx/specific/sun/Objectivity/5.0/java/lib/oojava.jar\
:/usr/local/libexec/jdk/1.1.6/lib/classes.zip"
setenv LD_LIBRARY_PATH "/usr/local/libexec/jdk/1.1.6/lib:${LD_LIBRARY_PATH}";
setenv JAVA_HOME "/usr/local/libexec/jdk/1.1.6"
export OBJY_VERS=5.1; source /afs/cern.ch/rd45/objy/objyenv.sh
setenv OBJY_VERS 5.1 source /afs/cern.ch/rd45/objectivity/objyenv.csh
#JAVA settings to use another version of JDK different from JDK1.1.6
setenv JAVA_HOME "/usr/local/libexec/jdk/< version >
setenv PATH "${JAVA_HOME}/bin:${PATH}"
setenv CLASSPATH ".:/afs/cern.ch/sw/lhcxx/specific/sun/Objectivity/5.1/java/lib/
oojava.jar:${JAVA_HOME}/lib/classes.zip:${CLASSPATH}"
setenv LD_LIBRARY_PATH "${JAVA_HOME}/lib:${LD_LIBRARY_PATH}"
1.Compile the files Vehicle.java , Fleet.java , VrcInit.java , and Vrc.java located in the GettingStarted subdirectory of the programming samples directory (d:\objy51\docs\java\samples\GettingStarted).
javac VrcInit.java javac Vrc.javaNote: you may get the error:
SIGSEGV 11* segmentation violation si_signo [11]:SIGSEGV 11*segmentation violation si_errno [0]: Error 0 si_code [1]: SEGV_MAPERR [addr: 0xad7ae2bc] stackbase=EFFFE9A0, stackpointer=EFFFE6E0
Objectivity for java in Solaris uses the system native threads, while the java virtual machine, by default, starts using green threads. To specify to the virtual machine that you want to use native threads, you should specify following flag:
java - YourClass
The bytecodes will be generated and stored on the .class files. In GettingStarted directory you will have following files :
Fleet.class Fleet.java Vehicle.class Vehicle.java Vrc.class Vrc.java VrcInit.class VrcInit.java2.Start an Objectivity/DB lockserver in your system,
d:\installDir\java\samples\GettingStarted\oolockserver3.Create a federated database called Vrc in the GettingStarted sample directory.
d:\installDir\java\samples\GettingStarted\oonewfd -fdfilepath d:\objy51\docs\java\samples\GettingStarted\Vrc.fdb -lockserverhostThe output will be:Vrc
Objectivity/DB (TM) Create Federated Database Utility, Version 5.1 Build: 58 Copyright (c) Objectivity, Inc 1993, 1998. All rights reserved. Federated Database "Vrc" created.You can check the catalog of the federated database if everything is right :
d:\objy51\docs\java\samples\GettingStarted>oodumpcatalog Vrc Objectivity/DB (TM) List Database Files Utility, Version 5.1 Build: 58 Copyright (c) Objectivity, Inc 1990, 1998. All rights reserved. FD Name = Vrc FD ID = 1 FD File = pc-01::D:\objy50\docs\java\samples\GettingStarted\Vrc.fdb Boot File = pc-01::D:\objy50\docs\java\samples\GettingStarted\Vrc Jnl Dir = pc-01::D:\objy50\docs\java\samples\GettingStarted Lock Host = pc-014.Execute VrcInit to initialize the federated database.
d:\installDir\java\samples\GettingStarted\java VrcInit When you execute VrcInit , the output will be: Created database "VehiclesDB". Created container "VehiclesContainer". Added vehicle: License:CA1234 Class:G Doors:4 MANUAL Rate:40 Added vehicle: License:CA7654 Class:H Doors:4 AUTOMATIC Rate:40Note: You can find more information about this example in the "Getting Started" chapter of the Objectivity for Java doucmentation. You will find other examples as indicated in the "Programming Examples" chapter. 5.Use oobrowse (in NT) or ootoolmgr (in UNIX) to browse the database VehiclesDB.
d:\installDir\java\samples\GettingStarted\oobrowse Vrc