When using the Local SDK, you will often times run into errors related to the ClassLaoder. A log will typically look like this. This article outlines a few causes and their solutions to this process.
java.lang.IllegalArgumentException: Could not load class dev.getelements.robloxkit.service.StandardRobloxAuthService : java.lang.NoClassDefFoundError: dev/getelements/robloxkit/RobloxAuthService
at io.github.classgraph.ScanResult.loadClass(ScanResult.java:1459)
at io.github.classgraph.ScanResultObject.loadClass(ScanResultObject.java:228)
at io.github.classgraph.ScanResultObject.loadClass(ScanResultObject.java:252)
at io.github.classgraph.FieldInfo.loadClassAndGetField(FieldInfo.java:260)
at java.base/
Code is missing the @ElementPublic annotation. #
Any class, interface, or package that is exposed as a service (via the @ElementServiceExport annotation) must also be made public. There’s a few ways to do this.
Ensure All Related Types Are Public
The requirement to be public requires to the interface type itself as well as any types referenced within the interface.
Ensure that the package is annotated with ElementPublic #
@ElementPublic
package com.example.mystudio.mygame;
import dev.getelements.elements.sdk.annotation.ElementPublic;
Ensure that the type is annotated with ElementPublic #
package com.example.mystudio.mygame;
import dev.getelements.elements.sdk.annotation.ElementPublic;
@ElementPublic
public interface MyInterface {
void foo();
}
A Required Dependency is Missing #
Each Element must supply its own dependencies. This means that the Element must have included that dependency on the Classpath. Our example projects automate this process using the Maven Copy Dependencies Plugin and the local SDK expects those dependencies to be provided in target/element-libs relative to your project directory. The local SDK Maven runner will attempt to run Maven just before your code runs, but this may not always work correctly.
Check your pom.xml #
The pom should have a step to copy those dependencies in. The snippet in our example code ensures that only third-party code is included in that directory.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>copy-element-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<prependGroupId>true</prependGroupId>
<excludeScope>provided</excludeScope>
<excludeGroupIds>ch.qos.logback</excludeGroupIds>
<excludeArtifactIds>sdk-local,sdk-local-maven,sdk-logback</excludeArtifactIds>
<outputDirectory>${project.build.directory}/element-libs</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Typically, everything you need should appear in your IDE:

Jars need Installed #
Because we use Maven to organize the local SDK, it will always copy from the jars installed in your Local Maven Repository. In short a Maven Repository is a directory containing compiled Java code in an organized directory structure complete with version tagging. Just before your code runs, the LocalSDK copies pre-built code from that directory and copies it to your project. If you are running a project for the first time, you may have to manually build and install the code.
To do this quickly, execute the following command in the root of your project:
mvn -DskipTests clean install
This tells Maven to clean, build, and install all jars in your project to your local Maven Repository. The -DskipTests ensures that integration and unit tests do not run, saving time and allowing you to debug code that may not be currently passing tests.

