Using the Equo SDK
In this section, we will explore how to use the Equo SDK in your application.
Using the Equo SDK in a Java Application with Maven
To consume the SDK libraries in your Maven-based project, you need to place the following lines in your pom.xml
file:
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>dev.equo</groupId>
<artifactId>dev.equo.sdk</artifactId>
<version>0.0.2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>chromium-swt-ee</id>
<url>https://dl.equo.dev/chromium-swt-ee/equo-gpl/mvn</url>
</repository>
</repositories>
You must also add the Equo Chromium dependencies, based on your operative system and architecture. Use one of the following options depending on your OS:
<!-- OS: Linux, Arch: x86_64 -->
<dependency>
<groupId>com.equo</groupId>
<artifactId>com.equo.chromium.cef.gtk.linux.x86_64</artifactId>
<version>116.0.6</version>
<scope>runtime</scope>
</dependency>
<!-- OS: Windows, Arch: x86_64 -->
<dependency>
<groupId>com.equo</groupId>
<artifactId>com.equo.chromium.cef.win32.win32.x86_64</artifactId>
<version>116.0.6</version>
<scope>runtime</scope>
</dependency>
<!-- OS: macOS, Arch: x86_64 -->
<dependency>
<groupId>com.equo</groupId>
<artifactId>com.equo.chromium.cef.cocoa.macosx.x86_64</artifactId>
<version>116.0.6</version>
<scope>runtime</scope>
</dependency>
<!-- OS: Windows, Arch: x86 -->
<dependency>
<groupId>com.equo</groupId>
<artifactId>com.equo.chromium.cef.win32.win32.x86</artifactId>
<version>116.0.6</version>
<scope>runtime</scope>
</dependency>
<!-- OS: Linux, Arch: aarch64 -->
<dependency>
<groupId>com.equo</groupId>
<artifactId>com.equo.chromium.cef.gtk.linux.aarch64</artifactId>
<version>116.0.6</version>
<scope>runtime</scope>
</dependency>
<!-- OS: macOS, Arch: aarch64 -->
<dependency>
<groupId>com.equo</groupId>
<artifactId>com.equo.chromium.cef.cocoa.macosx.aarch64</artifactId>
<version>116.0.6</version>
<scope>runtime</scope>
</dependency>
To run your application with Maven, run the following command in the command line:
mvn compile exec:java -f app
# or
mvn compile exec:java -f app -Dexec.mainClass="sdk.example.SimpleAppSample"
OSGi Maven Application
If you want to run OSGi as your application runtime you need to add the following dependencies. Here is a pom.xml
file example:
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>dev.equo</groupId>
<artifactId>dev.equo.sdk</artifactId>
<version>0.0.2</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>7.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.atomos</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<version>3.11.100</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi.util</artifactId>
<version>3.7.200</version>
</dependency>
</dependencies>
<repositories>
<repository>
<url>https://dl.equo.dev/chromium-swt-ee/equo-gpl/mvn</url>
</repository>
</repositories>
Then you can use OSGi features like the Service Registry, Dependency Model, Extender Pattern and some other OSGi Technologies.
To run your OSGi application with Maven, run the following command in the command line:
mvn compile exec:java -f osgi-app
# or
mvn compile exec:java -f osgi-app -Dexec.mainClass="sdk.osgi.example.SimpleOSGiAppSample"
Using the Equo SDK in a Java Application with Gradle
Java Gradle Application
To consume our libraries in your Gradle-based project, you need to include the Equo repository and dependency in your build.gradle
or build.gradle.kts
file:
repositories {
maven("https://dl.equo.dev/chromium-swt-ee/equo-gpl/mvn")
mavenCentral()
}
dependencies {
implementation("dev.equo:dev.equo.sdk:0.0.2")
}
To run your application with Gradle, run the following command in the command line:
./gradlew app:run
# or
./gradlew app:run -PmainClass="sdk.example.BrowserAppSample"
OSGi Gradle Application
If you want to run OSGi as your application runtime you need to add the next Gradle capability. Here is a build.gradle.kts
file example:
repositories {
maven("https://dl.equo.dev/chromium-swt-ee/equo-gpl/mvn")
mavenCentral()
}
dependencies {
implementation("dev.equo:dev.equo.sdk:0.0.2")
runtimeOnly("dev.equo:dev.equo.sdk:0.0.2") {
capabilities {
requireCapability("dev.equo:core-osgi-support")
}
}
}
Then you can use OSGi features like the Service Registry, Dependency Model, Extender Pattern and some other OSGi Technologies.
To run your OSGi application with Gradle, run the following command in the command line:
./gradlew osgi-app:run
# or
./gradlew osgi-app:run -PmainClass="sdk.osgi.example.BrowserAppSample"
How can I run the application?
Java Application
Running an application using Equo SDK in Java is as simple as importing EquoApp, invoking EquoApp.create("APP-ID")
, and then calling launch, as shown in the following example:
import com.equo.application.client.EquoApp;
import java.net.MalformedURLException;
import java.net.URL;
public class SimpleAppSample {
public static void main(String[] args) throws MalformedURLException {
EquoApp.create("SIMPLE-APP")
.launch("https://equo.dev");
}
}
OSGi Application
Otherwise, running the application using OSGi is as simple as adding the addOSGICompatibilityLayer() method to the EquoBuilder, as shown in the following example:
import com.equo.application.client.EquoApp;
import java.net.MalformedURLException;
import java.net.URL;
public class SimpleAppSample {
public static void main(String[] args) throws MalformedURLException {
EquoApp.create("OSGI-APP")
.addOSGICompatibilityLayer()
.launch("https://equo.dev");
}
}
Equo Chromium, Middleware, and Comm API, are exclusively intended for use in applications developed using the Equo SDK. If you want to embed or integrate Equo Chromium, Middleware, or the Comm API in an existing application (i.e. Eclipse RCP), please contact us for a commercial license. |