There are two distinct problems.
Since you are running on Linux, the class path separator is : rather than ; as shown in the video.
You need to include the JAR file or directory containing >>your<< code on the classpath. I expect that the video actually did this using the . character. Remember that on Windows AND Linux, . means "the current directory".
So you should be running the command on Linux like this:
$ java -cp .:protobuf-java-3.5.1.jar AddPerson addressbook.data
This assumes that your AddPerson class does not have a package declaration, and that AddPerson.class is in the current directory. It gets a bit more complicated if packages are involved.
Note that I put . in front of protobuf-java-3.5.1.jar on the classpath. It probably doesn't matter in this case, but in general the order does matter. The classloader searches for classes in a specific order1.
- first, the system classpath where the standard library classes live
- then, the Java installation's Extensions directory2
- finally, the locations in the application's classpath ... in the order that they are specified on the classpath.
The first one class with the correct (fully qualified) name that it finds will "win". So if your classpath was -cp protobuf-java-3.5.1.jar:. and there just happened to be3 an AddPerson class in protobuf-java-3.5.1.jar, then that would be loaded in preference to your class.
1 - This can be further tweaked by the application itself creating classloaders at runtime. But that is a different topic.
2 - For Java 8 and earlier. Support for the "extensions" mechanism was dropped in Java 9.
3 - Don't worry, there isn't. But the point is that the classpath order can matter.
AddPerson.exein your current folder. If it's not there, that's probably why this isn't working.