Compiled
I've compiled the java code, but I'm not able to run it. I compiled the code with the following:
javac -cp "streamer-client-java.jar:kafka-clients-3.4.0.jar:snappy-java-1.1.10.0.jar:lz4-java-1.8.0.jar:slf4j-api-2.0.7.jar:." EnduserCredentialExample.java
Currently, I'm getting this output:
Note: EnduserCredentialExample.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Tried running the compiled class
I also tried running with another approach:
java -cp "streamer-client-java.jar:kafka-clients-3.4.0.jar:snappy-java-1.1.10.0.jar:lz4-java-1.8.0.jar:slf4j-api-2.0.7.jar:." EnduserCredentialExample
Which, unfortunately, produces the following error:
Error: Could not find or load main class EnduserCredentialExample Caused by: java.lang.NoClassDefFoundError: com/quotemedia/streamer/client/example/EnduserCredentialExample (wrong name: EnduserCredentialExample)
And then I also tried running the code using .java (I added .java to it):
java -cp "streamer-client-java.jar:kafka-clients-3.4.0.jar:snappy-java-1.1.10.0.jar:lz4-java-1.8.0.jar:slf4j-api-2.0.7.jar:." EnduserCredentialExample.java
But this worked when running the normal java code but when I tried running the compiled class, I got this error:
Error: Could not find or load main class EnduserCredentialExample Caused by: java.lang.NoClassDefFoundError: com/quotemedia/streamer/client/example/EnduserCredentialExample (wrong name: EnduserCredentialExample)
You appear to be making a number of mistakes ...
Firstly you appear to be ignoring warnings about unchecked / unsafe conversions:
You need to do what the message says. Recompile that class with the
-Xlint:uncheckedoption. Then read the error messages and correct your source code.(Hint: I am NOT going to look at your Google drive to figure out errors are. You know what you need to do about that. I have told you ... twice already!!)
Next we have this error
That means that there is a mismatch between the package name of the class and its pathname in the file system. See this Q&A for an explanation:
Finally we have this error:
It appears that you have (previously) compiled
EnduserCredentialExamplewith Java 17 preview features enabled. That's OK ... but you also need to include--enable-previewin thejavacommand line options when you load and run the class. This Q&A may help you understand:Unless you are intentionally using preview features in your code, it is inadvisable to enable them at compile time.