Skip to content

Java SDK Import incorrect #25

@JustinDPerkins

Description

@JustinDPerkins

Issue

import com.trend.fs.AMaasClient;

means you're trying to use the AMaasClient class from a package named:

com.trend.fs

However, the Trend Micro Vision One File Security Java SDK (which you correctly linked to here) uses the package:

com.trend.cloudone.amaas

The issue is its importing from a non-existent package (com.trend.fs), which doesn't match the SDK's real package structure.

As a result, your Main.java couldn't find AMaasClient, and the compiler would’ve thrown:

error: package com.trend.fs does not exist

How this was verified:

jar tf ~/.m2/repository/com/trend/file-security-java-sdk/1.5.0/file-security-java-sdk-1.5.0.jar | grep AMaasClient

outputted:

sh-5.2$ jar tf ~/.m2/repository/com/trend/file-security-java-sdk/1.5.0/file-security-java-sdk-1.5.0.jar | grep AMaasClient
com/trend/cloudone/amaas/AMaasClient$2.class
com/trend/cloudone/amaas/AMaasClient$1.class
com/trend/cloudone/amaas/AMaasClient.class
com/trend/cloudone/amaas/AMaasClient$3.class
com/trend/cloudone/amaas/AMaasClient$AMaasServerCallback.class
sh-5.2$

This proved com.trend.fs.AMaasClient is not a valid class path in the SDK and why that import fails.


FIXED USED

I needed to modify the imports on the example provided:

import com.trend.cloudone.amaas.AMaasClient;
import com.trend.cloudone.amaas.AMaasException;

public class Main {
    public static void main(String[] args) {
        try {
            // AMaasClient(String region, String apiKey, long timeoutInMillis)
            AMaasClient client = new AMaasClient("us-east-1", "<V1_API_Key>", 10000); // 10 sec timeout

            try {
                String scanResult = client.scanFile("hello.txt");

                if (scanResult != null) {
                    System.out.println("Scan result: " + scanResult);
                }
            } finally {
                client.close();
            }

        } catch (AMaasException e) {
            System.out.println("Exception: " + e.getMessage());
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions