Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Creating a Java VM – PB Docs 2018 – PowerBuilder Library

Creating a Java VM – PB Docs 2018

Creating a Java VM

Before calling an EJB component, you need to create a Java VM using
the CreateJavaVM method of the JavaVM class. The first argument is a
string that specifies a classpath to be added to the beginning of the
classpath used by the Java VM.

A Java VM might already be loaded

The classpath argument is ignored if the Java VM is already
running.

Supported Java VM

PowerBuilder 2017 and later is compatible with Java VM 1.6 only
(not 1.7 or 1.8).

The second argument to createJavaVM is a boolean that specifies
whether debug information is written to a text file. See Debugging the client.

The JavaVM class has other methods that you can use when you create
a Java VM:

  • The CreateJavaInstance method creates an instance of the Java
    object from a proxy name.

  • The IsJavaVMLoaded method determines whether the Java VM is
    already loaded. Use this method before calling CreateJavaVM if you
    want to enable or disable some features of your application depending
    on whether the Java VM has already been loaded. This will ensure that
    the classpath argument passed to CreateJavaVM is ignored.

  • The GetJavaVMVersion method determines which version of the Java
    VM is running.

  • The GetJavaClasspath method determines the runtime classpath of
    the Java VM.

The JavaVM that you create using CreateJavaVM should be a global or
instance variable for the client application and should not be destroyed
explicitly.

The Java VM classpath in the development
environment

When PowerBuilder starts a Java VM, the Java VM uses internal path
and classpath information to ensure that required Java classes are always
available.

In the development environment, you can check whether the JVM is
running and, if so, which classpath it is using, on the Java page of the
System Options dialog box. The classpath is constructed by concatenating
these paths:

  • A classpath added programmatically when the Java VM is started.
    For example, the classpath you pass to the CreateJavaVM method.

  • The PowerBuilder runtime static registry classpath. This path is
    built into the pbjvm180.dll and contains classes required at runtime
    for EJB clients and other PowerBuilder features that use a Java
    VM.

  • The PowerBuilder system classpath. This path resides in a
    Windows registry key installed when you install PowerBuilder. It
    contains classes required at design time for Java-related PowerBuilder
    features such as JDBC connectivity.

  • The PowerBuilder user classpath. This is the path that you
    specify on the Java page of the System Options dialog box.

  • The system CLASSPATH environment variable.

  • The current directory.

The runtime Java VM
classpath

At runtime, you can use the GetJavaClasspath method to determine
what classpath the Java VM is using. The Java VM uses the following
classpath at runtime:

  • A classpath added programmatically when the Java VM is
    started

  • The PowerBuilder runtime static registry classpath

  • The system CLASSPATH environment variable

  • The current directory

For more information about the Java classpath at runtime, see Java support.

Classes required by servers

The classpath contains the classes required by EJB clients for the
J2EE application server, you need to add the classes required by the
application server to the system CLASSPATH. For example:

  • For WebLogic, weblogic.jar. This file is installed in
    wlserver6.1lib or weblogic700serverlib on the server.

  • For WebSphere, JAR files installed on the server in
    websphereappserverlib.

For detailed information about the files required on the client by
each application server, see the documentation for the server.

Examples

This example demonstrates the creation of an instance of the Java VM
that specifies the wlfullclient.jar file in a WebLogic installation as a
class path:

This additional code can be added to the previous example to create
a record of the Java VM version and classpath used:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x