// File: example1.java
public class example1 {
public static void main(String[] args)
{
if(args.length!=1) {
System.out.println("usage: java example1 <pvname>");
return;
}
try {
// Get the JCALibrary
instance.
JCALibrary jca=
JCALibrary.getInstance();
// Create a single threaded context
with default configuration values.
Context
ctxt= jca.createContext(JCALibrary.JNI_SINGLE_THREADED);
// Display basic information about
the context.
ctxt.printInfo();
// send the request and wait 5.0
seconds for the channel to connect to the PV.
ctxt.pendIO(5.0);
// If we're here, then everything
went fine.
// Display basic information about
the channel.
ch.printInfo();
// Disconnect the
channel.
ch.destroy();
// Destroy the context.
ctxt.destroy();
} catch(Exception ex) {
System.err.println(ex);
}
}
}
//File JCALibrary.properties
#define the location of the epics shared libraries and
caRepeater executable
#gov.aps.jca.jni.epics.win32-x86.library.path=
c:/epics/baseR3.14.4/bin/win32-x86
#gov.aps.jca.jni.epics.win32-x86.caRepeater.path=
c:/epics/baseR3.14.4/bin/win32-x86
gov.aps.jca.jni.epics.linux-x86.library.path=
/home/epicsadm/epics3.14.7/base-3.14.7/lib/linux-x86
gov.aps.jca.jni.epics.linux-x86.caRepeater.path=
/home/epicsadm/epics3.14.7/base-3.14.7/bin/linux-x86
# define default values for both JNI_THREAD_SAFE and
JNI_SINGLE_THREADED contexts.
gov.aps.jca.jni.JNIContext.preemptive_callback=
true
gov.aps.jca.jni.JNIContext.addr_list="192.168.44.244"
gov.aps.jca.jni.JNIContext.auto_addr_list=
true
gov.aps.jca.jni.JNIContext.connection_timeout=
30.0
gov.aps.jca.jni.JNIContext.beacon_period=
15.0
gov.aps.jca.jni.JNIContext.repeater_port=
5065
gov.aps.jca.jni.JNIContext.server_port= 5064
gov.aps.jca.jni.JNIContext.max_array_bytes=
16384
# define default values only for JNI_SINGLE_THREADED
context
gov.aps.jca.jni.SingleThreadedContext.event_dispatcher=
gov.aps.jca.event.DirectEventDispatcher
# define default values only for JNI_THREAD_SAFE
context
gov.aps.jca.jni.ThreadSafeContext.event_dispatcher=
gov.aps.jca.event.QueuedEventDispatcher
gov.aps.jca.jni.ThreadSafeContext.priority=
5
# define default values for QueuedEventDispatcher
components
gov.aps.jca.event.QueuedEventDispatcher= 5