---
title: Custom Code Overview
description: "--- ## Deploy custom code to your instance of Namazu Elements. Elements is highly extensible and allows you to develop custom code. Elements 3 is written in Java21 and therefore any VM compatible languages will work seamlessly in Elements. Building…"
url: "https://namazustudios.com/docs/custom-code/element-structure/"
updated: "2026-08-13"
category: "Your Game Code - Adding Custom Elements"
---

# Custom Code Overview

---

## Deploy custom code to your instance of Namazu Elements.

Elements is highly extensible and allows you to develop custom code. Elements 3 is written in Java21 and therefore any VM compatible languages will work seamlessly in Elements. Building your custom server side logic in Java-Based Languages has several [Distinct](https://namazustudios.com/glossary/distinct/) advantages.

- Java has one of the most complete ecosystems of readily available Open Source libraries available. Chances are, whatever you're looking for is available in a package on [Maven Central](https://central.sonatype.com).
- Java offers incredible server side performance through JIT Compliation, which essentially compiles your code to machine code as it is loaded.
- As of October 2023, it is estimated that the developer community size is approximately [17.1 Million](https://www.griddynamics.com/blog/number-software-developers-world) developers, ensuring you will have no problems building your team long-term.
- An existing suite of powerful development tools including IDEs and profilers/benchmarking tools are readily available.

Check out our example [Element](https://namazustudios.com/glossary/element/) project [here](https://github.com/Elemental-Computing/element-example)!

## Here's where you learn to develop your first [Element](https://namazustudios.com/glossary/element/).

Starting with Elements 3, we are now providing a way to develop custom extensions in Java Virtual Machine (or JVM) based languages. Refer to the [Wikipedia](https://en.wikipedia.org/wiki/List_of_JVM_languages) page for a complete list and determine the best language which works for your project. The most popular choices are Java and Kotlin. Elements is natively written in Java which is 100% compatible with any other JVM based language.

We call our fundamental plug-in an [Element](https://namazustudios.com/glossary/element/). Each [Element](https://namazustudios.com/glossary/element/) runs in an isolated environment using a [ClassLoader](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/ClassLoader.html) which isolates [Element](https://namazustudios.com/glossary/element/) from the [REST](https://namazustudios.com/glossary/rest/) of the system. A common problem Java developers face is conflicting dependencies within a single [Application](https://namazustudios.com/glossary/application/), colloquially known as "[Jar Hell.](https://en.wikipedia.org/wiki/Java_class_loader#JAR_hell)"

Our approach allows you to use develop in an environment without having to worry about conflicts between the Elements 3 code base and your [Element](https://namazustudios.com/glossary/element/)'s code. We provide a set of interfaces, but isolate their implementations from your code. When developing an [Element](https://namazustudios.com/glossary/element/), these are the key points you must know:

- You can incorporate almost any existing Java code base into Elements that are based on standard Java frameworks. Elements 3 Currently Supports:
- [Jakarta](https://namazustudios.com/glossary/jakarta/) RS 4.0.0
- [Jakarta](https://namazustudios.com/glossary/jakarta/) [Websockets](https://namazustudios.com/glossary/websockets/) 2.1.0
- You can include almost any third-party library into your code base without having to worry about it conflicting with the frameworks used to build Elements
- Note: You will need to copy all dependencies into your [Element](https://namazustudios.com/glossary/element/), except those as provided by Elements 3.
- An [Element](https://namazustudios.com/glossary/element/) does not have strict isolation, nor does it run in a sandbox. This is by design, as trying to enforce strong encapsulation using a Security Manager (or similar) would introduce a lot of overhead for no benefits. Take special care when accessing the [System ClassLoader](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/ClassLoader.html#getSystemClassLoader()).

### Defining an [Element](https://namazustudios.com/glossary/element/)

An [Element](https://namazustudios.com/glossary/element/) exists as a Java package and, optionally, include all sub-packages recursively. Elements are similar to [JPMS Modules](https://www.oracle.com/corporate/features/understanding-java-9-modules.html) but without the one jar per module restrictions.

The following example shows how to define an [Element](https://namazustudios.com/glossary/element/) in your Java code. Note we do require that you define a `package-info` for the package. The following is the simplest [Element](https://namazustudios.com/glossary/element/) possible.

```
// Defines the Package. Specifies as recursive.
@ElementDefinition(recursive = true)
package com.mystudio.mygame.api;

// Imports the Element SDK Annotation
import dev.getelements.elements.sdk.annotation.Element
```

This indicates that the package `com.mystudio.mygame.api`and all sub packages will be included in the [Element](https://namazustudios.com/glossary/element/) for associated services.

### Packaging an [Element](https://namazustudios.com/glossary/element/)

Packaging an [Element](https://namazustudios.com/glossary/element/) or collection of Elements uses a simple directory structure. Elements 3.0 will search for the following files and directories when loading the assets associated with an [Element](https://namazustudios.com/glossary/element/):

- `dev.getelements.Element.attributes.properties` - A standard [Java Properties](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Properties.html) file which define the [Element](https://namazustudios.com/glossary/element/)'s [Application](https://namazustudios.com/glossary/application/)
- `libs` - A directory containing jar files. The loader scans the directory for jar files and adds them to the [Element](https://namazustudios.com/glossary/element/)'s classpath.
- `classpath` - A directory containing assets to add directly to the [Element](https://namazustudios.com/glossary/element/)'s classpath.

Additionally, the following rules apply when scanning a directory for Elements.

- Any file not otherwise specified would be ignored.
- Any directory will be treated as a new [Element](https://namazustudios.com/glossary/element/), provided that that at least `libs` or `classpath` exist.
- **Note:** Elements defined in directories will inherit the classpath of the parent which allows you to put common code in the parent directory.

## Next steps:

See our intro to [Jakarta and Guice](https://namazustudios.com/docs/custom-code/introduction-to-guice-and-jakarta-in-elements/) if you're not familiar with those tools, then check out [Structuring an Element](https://namazustudios.com/docs/custom-code/structuring-your-element/) to get started!
