In 2016, I was able to run java code in eclipse on Windows 8, with opencv. Then take the class files and copy them to the pi, compile them, and run them on the pi too.
Yesterday I was able to to take Class and Java Files located in a single directory and copy them to the pi, compile, and run them. However I can not run them on the PC. This was a simple opencv eye matrix example. I then successfully wrote a program to read a frame from the camera on the pi and save it to a jpg file.
Currently I am struggling with running a program with multiple java and class files. Especially when they are in separate folders. We used to be able to set the environment CLASSPATH to compile, and both CLASSPATH and the -DjavaLibraryPath during run to run files both on the PC and the pi. The -DjavaLibraryPath points to the locations of runtime executables (.dll on Windows, and .so on Linux). While the CLASSPATH environment variable or -cp option points to Jar and Java files.
But when we put these files in packages, then its a pain to figure out why the java interpreter can’t find something. And when we look at Maven or Gradle projects we can’t find where Maven and Gradle put things so that we may figure out the correct CLASSPATH environment variables nor -DjavaLibraryPath to run the examples.
That would be okay if the examples did exactly what we want. But when we want to run our own code we don’t know what to do. Unless we have the time to figure out maven and gradle and vscode.
And heaven help our students figure out maven and gradle and java and vscode and pi and linux and Windows. While gradle and maven make it easier for real programmers on large projects to compile their stuff they hide what is actually going on. ie running a compiler and then running the program.
We are lucky to keep a student interested in programming long enough to figure any of this out.
After 11 years, we had one student, with significant help from me, write one Class for a subsystem. We still had to modify the methods to work with a Command Based Code. And our programmer completely rewrote everything we did. (We may actually be doing more harm discouraging them that good).
I can compile and run an opencv program on the pi, but only if there is no package and the source file and output Class are in a single folder. I’ve spent six 8 hour days to get to this point. I wrote my first Basic program 44 years ago.