System Requirements

P4 API for Java is certified for use with the 2025.2 P4 Server. Older server versions may function but are not officially supported. For more information, see the Release Notes.

Due to current US export control restrictions for some countries, the standard JDK package only comes with 128 bit encryption level cyphers.

In order to use P4 API for Java to connect to an SSL-enabled P4 Server, those living in eligible countries may download the unlimited strength JCE (Java Cryptography Extension) package and replace the current default cryptography jar files with the unlimited strength files. For more information about using P4 API for Java with an SSL enable P4 Server, see the Perforce support article.

Java Compatibility

  • Requires JDK 11 or later (full standard edition).

  • See Known limitations for implementation-specific considerations.

SSL Requirements

To enable 256-bit SSL encryption, the Unlimited Strength JCE (Java Cryptography Extension) must be installed for your JDK version.The standard JDK includes only 128-bit cipher support.

SSL and Trust Establishment

P4 API for Java supports secure connections to P4 Server (version 2021.1 or later) using 256-bit SSL encryption and trust establishment via public key fingerprint acceptance.

To connect securely:

  1. Install the Unlimited Strength JCE package for your JDK.

  2. Use the p4javassl:// protocol in your server URI.

  3. Establish trust using:

    IOptionsServer.addTrust()

For example:

Copy
try {
    String serverUri = "p4javassl://perforce:1667";
    Properties props = null;
    IOptionsServer server = ServerFactory.getOptionsServer(serverUri, props);
    server.addTrust(new TrustOptions().setAutoAccept(true));
    IServerInfo serverInfo = server.getServerInfo();
} catch (P4JavaException e) {
    // handle P4Java exception
} catch (Exception e) {
    // handle other exceptions
}

TLS Configuration

From P4 API for Java 2020.1, TLSv1.2 is the default protocol. You can override this using:

java -DsecureSocketEnabledProtocols=TLSv1.2

Known limitations

  • File Permissions: P4 API for Java does not honor Unix/Linux umask settings by default. This is a JVM limitation. You can implement a custom ISystemFileCommandsHelper as described in the User Guide.

  • JVM NIO Dependency: P4 API for Java relies on the JVM’s NIO implementation. Performance and correctness may vary depending on platform support.

  • Unicode Encoding Issues: P4 API for Java cannot reliably handle files added as "shiftjis" when they are actually "CP932" or "MS932" encoded. This may cause sync/submit failures with errors like "Translation of file content failed".

  • Encryption Restrictions: The standard JDK includes only 128-bit encryption. To use 256-bit SSL with P4 API for Java, users in eligible countries must install the Unlimited Strength JCE package and replace:

    <java-home>/lib/security/local_policy.jar
    <java-home>/lib/security/US_export_policy.jar
  • Altsync Clients: P4 API for Java does not support file operations on altsync-enabled clients.