FONT_HERSHEY_SIMPLEX is deleted from Imgproc class in JAVA - java

I'm working on a face recognition project using opencv and opencv contrib libraries, and when I do run my code, it gives me this error :
java: cannot find symbol
symbol: variable FONT_HERSHEY_SIMPLEX
location: class org.opencv.imgproc.Imgproc
and when I search into the Imgproc class I discovered that FONT_HERSHEY_SIMPLEX field didn't include in the class !!
Please if can you help me !!

The location of this depends on the version of opencv you are using. For example, in version 3.4 it can be found in org.opencv.core.Core (documented here), and in version 4.2 it can be found in the class you are expecting it (documented here)
Since you are presumably following instructions based on a later version I suggest you use version 4.2 at least.

Related

SWT: Method Monitor#getZoom() cannot be found

The org.eclipse.swt.widgets.Monitor class is supposed to have an instance method called getZoom, which should return the zoom factor set on the particular monitor. It is documented here (after clicking on "Monitor"):
https://help.eclipse.org/2021-03/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/package-summary.html
However, when trying to compile the following code...
Monitor monitor = Display.getDefault().getPrimaryMonitor();
int zoom = monitor.getZoom();
..., I get an error saying:
java: cannot find symbol
symbol: method getZoom()
location: variable monitor of type org.eclipse.swt.widgets.Monitor
The method is documented to exist since SWT version 3.107, and I'm using version 4.6.1. All other methods of the Monitor class work as expected.
What am I missing here?
(If there is further information needed to answer this question, please feel free to ask.)
SWT versions do not match Eclipse versions. 4.6.1 is your Eclipse version (Eclipse Neon), this contains SWT version 3.105.1 which is too old.
SWT 3.107 was first included in Eclipse 4.8 (Eclipse Photon). I think later versions extend the platforms on which zoom is supported so you should try to move to the current Eclipse 2021-03 (2021-06 shortly)

How to make ProgressiveMediaSource usable in ExoPlayer? Symbol not found

I am working on a project where I am trying to implement ExoPlayer to replace a VideoView. My issue is that I am getting this error: cannot find symbol class ProgressiveMediaSource
I have seen Why can't I locate ProgressiveMediaSource? and note that it is mentioned that ProgressiveMediaPlayer was added in ExoPlayer 2.10.0 - I am using 2.10.1 so version shouldn't be an issue. The other condition that was mentioned was having the Android project upgraded to AndroidX. I believe that I am only using AndroidX unless one of my dependencies is importing some support libraries (com.android.support).
The compiler throws an error on import:
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
If providing my gradle build script would help, let me know.
Error was due to human transcription error. I had typed progessive instead of progressive and never noticed until much later 😫
Lesson: if a symbol can't be found, make sure you spelled it correctly.

Cannot compile with protocol buffers 3.1.0

I downloaded/installed protocol buffers 3.1.0 and used protoc to compile a .proto file which generated a .java class for me.
With this change, everything works/compiles.
Then I replaced the avro jars with their latest versions and tried to compile my project again, but no luck, it's complaining this error:
# Compile: pregen/media.proto
pregen/media.proto/serializers/protobuf/media/MediaContentHolder.java:828: error: cannot find symbol
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
^
symbol: class OneofDescriptor
location: class Descriptors
pregen/media.proto/serializers/protobuf/media/MediaContentHolder.java:2669: error: cannot find symbol
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
^
symbol: class OneofDescriptor
location: class Descriptors
pregen/media.proto/serializers/protobuf/media/MediaContentHolder.java:4131: error: cannot find symbol
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
^
symbol: class OneofDescriptor
location: class Descriptors
3 errors
I did a lot search/research and still no luck, also looked at this most relevant post: Problems using protobufs with java and scala
and then I compiled my generated .java file along with protobuf.3.1.0.jar into a new jar and placed it under my lib/, but the project still cannot compile.
Any help on how to resolve this issue please?
(I'm using an open-source project to benchmark Java serialzation performance, and I've posted a more detailed question/issue there as well.)
One of the authors of that open source projects helped me resolve the issue, copy the solution here as well:
"The problem was that avro-tools-1.8.1.jar bundles some of the Protobuf
class files (ugh). The bundled class files aren't compatible with the ones
our generated Protobuf code relies on.
We're pretty fast and loose with what's on the classpath; we just include
"lib/*.jar". It would be nice to be more precise with dependencies at some
point.
But as a quick fix, I put avro-tools-1.8.1.jar in "lib/extra/", so it won't
get picked up by default. The Makefile now specifically references that
JAR only when we need to run the Avro code generator."
Thanks.

Javah and Eclipse missing class files (android.support.v4.app.FragmentActivity)

I want to generate headers using javah but when i do i get an error:
Error: cannot access android.support.v4.app.FragmentActivity
class file for android.support.v4.app.FragmentActivity not found
I created new External Tool with this parameters:
Location: D:\Android\jdk1.7.0_51\bin\javah.exe
Working Directory: D:\Android\workspace\MyApp\bin\
Arguments: -d D:\Android\workspace\MyApp\jni -classpath D:\Android\workspace\MyApp\bin\classes;D:\Android\workspace\appcompat_v7\libs\android-support-v7-appcompat.jar com.example.myapp.MainActivity
I use last version of Android SDK and NDK as last version of Java.
Any suggestions?
This can be solved by adding android-support-v4.jar to your javah class path arguments.
I am not an Android developer, this was a result of hunting around on Google (for example, information derived indirectly from the answer to IntelliJ 12 + ActionBarSherlock setttings: Could not find class 'android.support.v4.app.FragmentActivity'). I do not know why this is required in addition to standard v7 jars, and I am posting this answer as community wiki in hopes that somebody with more experience can edit it to add some more information in the future.

Cannot Find Symbol createAccessBeans(java.util.Collection) when Compiling EJB 1.1 IBM Commerce Project

I am trying to "Mavenize" our existing Commerce solution. However, I am getting a weird error when I try to run mvn compile I get the following error.
[ERROR] /home/user/tmp/IBM/WCDE_ENT70/workspace/WebSphereCommerceServerExtensionsData/ejbModule/org/ecommerce/wcs/changerequest/ChangeRequestAccessBean.java:[347,32] cannot find symbol
[ERROR] symbol : method createAccessBeans(java.util.Collection)
[ERROR] location: class org.ecommerce.wcs.changerequest.ChangeRequestAccessBean
When I check the class it is related to the com.ibm.ivj.ejb.runtime.AbstractEntityAccessBean class which IBM has neglected to include JavaDoc for anywhere. I look into eclipse and it shows me the method in question was correct using code complete, however, it still fails with maven.
I am wondering if it isn't a customisation to the IBM jre (I am not using that for this POC) and if there is no way around it (short of extending the class and reimplementing).
Anyone?
Problem had to do with multiple imports of different versions of the same dependency. Now this has been resolved.

Categories

Resources