diff --git a/sre/io.janusproject/io.janusproject.plugin/pom.xml b/sre/io.janusproject/io.janusproject.plugin/pom.xml
index 0998877c9f..f0838a44b6 100644
--- a/sre/io.janusproject/io.janusproject.plugin/pom.xml
+++ b/sre/io.janusproject/io.janusproject.plugin/pom.xml
@@ -17,6 +17,7 @@
2.${project.version}
io.janusproject.Boot
+ io.janusproject.Bootstrap
@@ -115,12 +116,14 @@
--
${cliRunnerMainClass}
+ ${bootstrap}
updatemanifest
+ addbootstrap
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java b/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java
index 53289c9484..395deb7d38 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java
+++ b/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java
@@ -57,6 +57,8 @@
import io.janusproject.services.network.NetworkConfig;
import io.janusproject.util.LoggerCreator;
+import io.sarl.core.SRE;
+import io.sarl.core.SREBootstrap;
import io.sarl.lang.SARLVersion;
import io.sarl.lang.core.Agent;
@@ -909,6 +911,11 @@ public static Kernel startJanusWithModule(Module startupModule, Class extends
// Get the start-up injection module
assert startupModule != null : "No platform injection module"; //$NON-NLS-1$
final Kernel k = Kernel.create(startupModule);
+ // Force the bootstrap to reference the created kernel.
+ final SREBootstrap bootstrap = SRE.getBootstrap();
+ if (bootstrap instanceof Bootstrap) {
+ ((Bootstrap) bootstrap).setKernel(k);
+ }
final Logger logger = k.getLogger();
if (logger != null) {
logger.info(MessageFormat.format(Messages.Boot_22, agentCls.getName()));
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Bootstrap.java b/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Bootstrap.java
new file mode 100644
index 0000000000..0dae9bb8c8
--- /dev/null
+++ b/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Bootstrap.java
@@ -0,0 +1,89 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2017 the original authors or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.janusproject;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import io.janusproject.kernel.Kernel;
+
+import io.sarl.core.SREBootstrap;
+import io.sarl.lang.core.Agent;
+
+/**
+ * Represents an access point to the SARL run-time environment (SRE).
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.6
+ */
+public final class Bootstrap implements SREBootstrap {
+
+ private volatile Kernel kernel;
+
+ /** Change the current kernel.
+ *
+ * @param kernel the kernel.
+ */
+ void setKernel(Kernel kernel) {
+ this.kernel = kernel;
+ }
+
+ @Override
+ public UUID startAgent(Class extends Agent> agentCls, Object... params) throws Exception {
+ final Kernel kern = this.kernel;
+ if (kern == null) {
+ synchronized (this) {
+ this.kernel = Boot.startJanus(agentCls, params);
+ }
+ return Boot.getBootAgentIdentifier();
+ }
+ return kern.spawn(agentCls, params);
+ }
+
+ @Override
+ public Iterable startAgent(int nbAgents, Class extends Agent> agentCls, Object... params) throws Exception {
+ Kernel kern = this.kernel;
+ if (kern == null) {
+ final List spawned = new ArrayList<>();
+ synchronized (this) {
+ this.kernel = Boot.startJanus(agentCls, params);
+ kern = this.kernel;
+ }
+ spawned.add(Boot.getBootAgentIdentifier());
+ if (nbAgents > 1) {
+ spawned.addAll(kern.spawn(nbAgents - 1, agentCls, params));
+ }
+ return spawned;
+ }
+ return kern.spawn(nbAgents, agentCls, params);
+ }
+
+ @Override
+ public UUID getBootAgentIdentifier() {
+ return Boot.getBootAgentIdentifier();
+ }
+
+}
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/eclipse/sre/JanusSREInstall.java b/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/eclipse/sre/JanusSREInstall.java
index e956dca79d..1db973d375 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/eclipse/sre/JanusSREInstall.java
+++ b/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/eclipse/sre/JanusSREInstall.java
@@ -31,6 +31,7 @@
import org.w3c.dom.Element;
import io.janusproject.Boot;
+import io.janusproject.Bootstrap;
import io.janusproject.JanusConfig;
import io.janusproject.eclipse.buildpath.JanusClasspathContainer;
@@ -76,6 +77,7 @@ public JanusSREInstall() {
this.location = this.janusSREInstallPath.toPortableString();
setName(JanusConfig.JANUS_DEFAULT_PLATFORM_NAME);
setMainClass(Boot.class.getName());
+ setBootstrap(Bootstrap.class.getName());
//
setClassPathEntries(dependencies.getTransitiveRuntimeClasspathEntries(true));
}