0

I am new to Java environment, I'm trying to run a Coap server using Californium https://github.com/eclipse-californium/californium

I cloned the git repo. then ran mvn clean install in the repo folder. I now want to run the hello world demo in californium/demo-apps/cf-helloworld-server/

what is the next step?

I opened the folder cd demo-apps/cf-helloworld-server then ran

  • mvn clean install
  • mvn compile

it worked without errors, now how to run the server?

if I run:

java target.classes.org.eclipse.californium.examples.HelloWorldServer

I get this error

Error: Unable to initialize main class org.eclipse.californium.examples.Server
Caused by: java.lang.NoClassDefFoundError: org/eclipse/californium/elements/exception/ConnectorException
abdo Salm
  • 1,678
  • 4
  • 12
  • 22
  • 1
    Two things to note: 1. `mvn compile` is not needed once you have run `mvn clean install` and 2. In case of maven you don't actually run a java class, but instead run the executable (`jar` in your case) that was generated by the `mvn clean install` that you ran. You can find the jar directly under the `target` directory and execute it with `java -jar ` – Asif Kamran Malick Sep 20 '22 at 17:47

1 Answers1

0

Please build not only a demo-app, that doesn't work from scratch.

Instead build the parent (root folder of californium) with

mvn clean install

Afterwards change to the app directory, e.g. "demo-apps/cd-helloworld-server". There you start the server with

"java -jar target/cf-helloworld-server-3.7.0-SNAPSHOT.jar"

and you get the output:

Californium (Cf) Server-Starter (c) 2020, Bosch.IO GmbH and others

Usage: Server (HelloWorldServer|MulticastTestServer)

Follow the usage:

"java -jar target/cf-helloworld-server-3.7.0-SNAPSHOT.jar HelloWorldServer"

and you run the HelloWorldServer.

Achim Kraus
  • 729
  • 1
  • 7
  • 11