简体   繁体   中英

How to run helloWorld using Maven californium - Java

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

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, eg "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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM