We tried to get livestream data from an ultrasonic sensor connected to the raspberry pi 3 to Thingworx. But when we try to execute the java archive, we get an error message that the -jar main class could not be loaded or found. You find this error message attached.
Thanks in advance for every answer.
It seems like you have not specified the class-path correctly.
Read the Article to understand and setting of class path.
Since it's well know issue which anyone faces if classpath and classnames are not mentioned , I would suggesting looking for “Could not find or load main class” Error while running java program using cmd prompt" online to know more about this.
Thank you. I set the classpath right and it worked. But the output of the command does not look like it should. It appears an error that shuts down the EMS. Any further ideas to solve this issue? You can again find a screenshot attached.
Thanks in advance.
Again it throwing exception java.lang.NumberFormatException for Input String as shown in screenshot , is this input string is appkey ? Did you copied it correctly , does it have white spaces.
Also , let me know what other changes you made before running the jar on RPI
Yes, this input string is the appkey. I'm relatively sure that I copied it correctly and there aren't any white spaces.
There aren't many changes I do before. I only installed java jdk7, used chmod +x on ultrasonic.py and set the correct classpath.
The command should look like this: java –jar ultrasonic.jar ws://yourInstanceURL:80/Thingworx/WS YourAppKey pinIn pinout
and the output should look like this:
I got this from a PTC software engineer, but his mail account apparently doesn't exist anymore.
Try to use IP of the Thingworx server rather than Hostname. Not sure if this will resolve the problem here , but it resolved the similar kind of issue once for Debanjan Bose .
Also , I would suggest using same version (i.jdk1.8) while making the jar and also while running the jar from RPI.
Thanks Ravi, you already helped me a lot.
I put the IP in for the host name, but the connection was unsuccessfull. The jdk version installed on the pi should be the correct one.
Any further ideas?
The error which you are getting now is again related to classpath and/or missing jars: "you dont have java assist in your classpath or you have dont have enough permission to dynamically load classes"
Javassist is a library for byte code manipulation.
Seems , more like environment issue or issue related with compilations and adding third party jars while making the build .
Which build tool are u using to make the jars ? if maven is being used , Please add the following lines in pom.xml and then make the jar again.