Image for compiling and running JADE-based applications
281
Please refer to this repo for the source code. The image can be used for both compiling and running JADE-based applications.
Warning: The official JADE website appears to be down at the time of this writing. As a result, the image uses another repo to build JADE .jar file. I downloaded JADE's source code a while back, and now that the official website is down, I've put everything in this repo.
Pull the image:
docker pull masoudkf/java-jade
Move to your project directory:
cd <Your-Project-Directory>
Write your agent:
cat >./HelloWorld.java <<EOL
import jade.core.Agent;
public class HelloWorld extends Agent
{
protected void setup()
{
System.out.println("Hello World!");
System.out.println("My name is "+ getLocalName());
}
}
EOL
Compile your files:
docker run -v $(pwd):/app --name jade-test --rm masoudkf/java-jade
This will put the compiled files in the current directory. The default command is javac -d . *.java. If you want to run a different command for compiling, you can add it to the command above. You can also add files to the CLASSPATH environment variable by passing the CP env in the run command.
docker run -v $(pwd):/app --name jade-test -e CP=./mylib.jar --rm masoudkf/java-jade javac MyFile.java
Run this command after compiling your files:
docker run -v $(pwd):/app --name jade-test --rm masoudkf/java-jade java jade.Boot -agents hwagent:HelloWorld
You should see this output:
Hello World!
My name is hwagent
Content type
Image
Digest
Size
88.8 MB
Last updated
almost 5 years ago
docker pull masoudkf/java-jade