Problem with some LWJGL classes on import (Eclipse) - java

I downloaded the release build without modifying (https://www.lwjgl.org/customize)
I put all the classes in Eclipse. Some classes are not recognized
The codes that do not need these classes in error, work normally. As in https://www.lwjgl.org/guide
All the classes I put:
joml-1.10.1.jar
joml-1.10.1-javadoc.jar
joml-1.10.1-sources.jar
lwjgl.jar
lwjgl-assimp.jar
lwjgl-assimp-javadoc.jar
lwjgl-assimp-natives-windows.jar
lwjgl-assimp-sources.jar
lwjgl-bgfx.jar
lwjgl-bgfx-javadoc.jar
lwjgl-bgfx-natives-windows.jar
lwjgl-bgfx-sources.jar
lwjgl-cuda.jar
lwjgl-cuda-javadoc.jar
lwjgl-cuda-sources.jar
lwjgl-egl.jar
lwjgl-egl-javadoc.jar
lwjgl-egl-sources.jar
lwjgl-glfw.jar
lwjgl-glfw-javadoc.jar
lwjgl-glfw-natives-windows.jar
lwjgl-glfw-sources.jar
lwjgl-javadoc.jar
lwjgl-jawt.jar
lwjgl-jawt-javadoc.jar
lwjgl-jawt-sources.jar
lwjgl-jemalloc.jar
lwjgl-jemalloc-javadoc.jar
lwjgl-jemalloc-natives-windows.jar
lwjgl-jemalloc-sources.jar
lwjgl-libdivide.jar
lwjgl-libdivide-javadoc.jar
lwjgl-libdivide-natives-windows.jar
lwjgl-libdivide-sources.jar
lwjgl-llvm.jar
lwjgl-llvm-javadoc.jar
lwjgl-llvm-natives-windows.jar
lwjgl-llvm-sources.jar
lwjgl-lmdb.jar
lwjgl-lmdb-javadoc.jar
lwjgl-lmdb-natives-windows.jar
lwjgl-lmdb-sources.jar
lwjgl-lz4.jar
lwjgl-lz4-javadoc.jar
lwjgl-lz4-natives-windows.jar
lwjgl-lz4-sources.jar
lwjgl-meow.jar
lwjgl-meow-javadoc.jar
lwjgl-meow-natives-windows.jar
lwjgl-meow-sources.jar
lwjgl-nanovg.jar
lwjgl-nanovg-javadoc.jar
lwjgl-nanovg-natives-windows.jar
lwjgl-nanovg-sources.jar
lwjgl-natives-windows.jar
lwjgl-nfd.jar
lwjgl-nfd-javadoc.jar
lwjgl-nfd-natives-windows.jar
lwjgl-nfd-sources.jar
lwjgl-nuklear.jar
lwjgl-nuklear-javadoc.jar
lwjgl-nuklear-natives-windows.jar
lwjgl-nuklear-sources.jar
lwjgl-odbc.jar
lwjgl-odbc-javadoc.jar
lwjgl-odbc-sources.jar
lwjgl-openal.jar
lwjgl-openal-javadoc.jar
lwjgl-openal-natives-windows.jar
lwjgl-openal-sources.jar
lwjgl-opencl.jar
lwjgl-opencl-javadoc.jar
lwjgl-opencl-sources.jar
lwjgl-opengl.jar
lwjgl-opengles.jar
lwjgl-opengles-javadoc.jar
lwjgl-opengles-natives-windows.jar
lwjgl-opengles-sources.jar
lwjgl-opengl-javadoc.jar
lwjgl-opengl-natives-windows.jar
lwjgl-opengl-sources.jar
lwjgl-openvr.jar
lwjgl-openvr-javadoc.jar
lwjgl-openvr-natives-windows.jar
lwjgl-openvr-sources.jar
lwjgl-opus.jar
lwjgl-opus-javadoc.jar
lwjgl-opus-natives-windows.jar
lwjgl-opus-sources.jar
lwjgl-ovr.jar
lwjgl-ovr-javadoc.jar
lwjgl-ovr-natives-windows.jar
lwjgl-ovr-sources.jar
lwjgl-par.jar
lwjgl-par-javadoc.jar
lwjgl-par-natives-windows.jar
lwjgl-par-sources.jar
lwjgl-remotery.jar
lwjgl-remotery-javadoc.jar
lwjgl-remotery-natives-windows.jar
lwjgl-remotery-sources.jar
lwjgl-rpmalloc.jar
lwjgl-rpmalloc-javadoc.jar
lwjgl-rpmalloc-natives-windows.jar
lwjgl-rpmalloc-sources.jar
lwjgl-shaderc.jar
lwjgl-shaderc-javadoc.jar
lwjgl-shaderc-natives-windows.jar
lwjgl-shaderc-sources.jar
lwjgl-sources.jar
lwjgl-sse.jar
lwjgl-sse-javadoc.jar
lwjgl-sse-natives-windows.jar
lwjgl-sse-sources.jar
lwjgl-stb.jar
lwjgl-stb-javadoc.jar
lwjgl-stb-natives-windows.jar
lwjgl-stb-sources.jar
lwjgl-tinyexr.jar
lwjgl-tinyexr-javadoc.jar
lwjgl-tinyexr-natives-windows.jar
lwjgl-tinyexr-sources.jar
lwjgl-tinyfd.jar
lwjgl-tinyfd-javadoc.jar
lwjgl-tinyfd-natives-windows.jar
lwjgl-tinyfd-sources.jar
lwjgl-tootle.jar
lwjgl-tootle-javadoc.jar
lwjgl-tootle-natives-windows.jar
lwjgl-tootle-sources.jar
lwjgl-vma.jar
lwjgl-vma-javadoc.jar
lwjgl-vma-natives-windows.jar
lwjgl-vma-sources.jar
lwjgl-vulkan.jar
lwjgl-vulkan-javadoc.jar
lwjgl-vulkan-sources.jar
lwjgl-xxhash.jar
lwjgl-xxhash-javadoc.jar
lwjgl-xxhash-natives-windows.jar
lwjgl-xxhash-sources.jar
lwjgl-yoga.jar
lwjgl-yoga-javadoc.jar
lwjgl-yoga-natives-windows.jar
lwjgl-yoga-sources.jar
lwjgl-zstd.jar
lwjgl-zstd-javadoc.jar
lwjgl-zstd-natives-windows.jar
lwjgl-zstd-sources.jar

You are trying to compile LWJGL 2 code here. All the imports that it cannot find pertain to the verison 2 of LWJGL. The current version that you can get from the mentioned lwjgl site is 3 and version 3 is incompatible with version 2.
Either explicitly download LWJGL 2 from e.g. http://legacy.lwjgl.org/ or rewrite your code to work with LWJGL 3.
If you go the LWJGL 2 route, though, please note that it hasn't been actively maintained anymore for more than 6 years now.

Related

SURF and SIFT algorithms doesn't work in OpenCV 3.0 Java

I am using OpenCV 3.0 (the latest version) in Java, but when I use SURF algorithm or SIFT algorithm it doesn't work and throws Exception which says: OpenCV Error: Bad argument (Specified feature detector type is not supported.) in cv::javaFeatureDetector::create
I have googled, but the answers which was given to this kind of questions did not solve my problem. If anyone knows about this problem please let me know.
Thanks in advance!
Update: The code below in third line throws exception.
Mat img_object = Imgcodecs.imread("data/img_object.jpg");
Mat img_scene = Imgcodecs.imread("data/img_scene.jpg");
FeatureDetector detector = FeatureDetector.create(FeatureDetector.SURF);
MatOfKeyPoint keypoints_object = new MatOfKeyPoint();
MatOfKeyPoint keypoints_scene = new MatOfKeyPoint();
detector.detect(img_object, keypoints_object);
detector.detect(img_scene, keypoints_scene);
If you compile OpenCV from source, you can fix the missing bindings by editing opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp yourself.
I fixed it by making the following changes:
(line 6)
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
#include "features2d_converters.hpp"
...(line 121)
case SIFT:
fd = xfeatures2d::SIFT::create();
break;
case SURF:
fd = xfeatures2d::SURF::create();
break;
...(line 353)
case SIFT:
de = xfeatures2d::SIFT::create();
break;
case SURF:
de = xfeatures2d::SURF::create();
break;
The only requirement is that you build opencv_contrib optional module along with your sources (you can download the git project from https://github.com/Itseez/opencv_contrib and just set its local path on opencv's ccmake settings.
Oh, and keep in mind that SIFT and SURF are non-free software ^^;
That is because they are not free in newer versions of OpenCV (3+). I faced that problem some time ago. You have to:
Download OpenCV (if you have not)
Download the nonfree part from opencv github repo
Generate the makefiles with cmake -DBUILD_SHARED_LIBS=OFF specifying the nonfree part with DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules option and build with make -j8 (or whatever Java version you use)
Edit features2d_manual.hpp file, including opencv2/xfeatures2d.hpp and including the necessary code for SIFT and SURF case, which are commented and not defined:
fd=xfeatures2d::SIFT::create(); for SIFT descriptor and de = xfeatures2d::SIFT::create(); for SIFT extractor. Do the same for SURF if you want to use it too.
I wrote this post explaining step by step how to compile the non-free OpenCV part in order to use privative tools like SIFT or SURF.
Compile OpenCV non-free part.
I believe changing features2d module (FeatureDetector class or any other classes from features2d_manual.hpp) to enable methods from OpenCV contrib modules is less attractive approach because it leads to circular dependency between the "core" OpenCV and extensions (which can be non-free or experimental).
There is another way to fix this issue without affecting feature2d classes. Making changes in xfeatures2d CMakeLists.txt as described here leads to generation of java wrappers for SIFT and SURF - opencv-310.jar has org.opencv.xfeatures2d package now. Some fix was required in /opencv/modules/java/generator/gen_java.py. Namely inserted 2 lines as shown below:
def addImports(self, ctype):
if ctype.startswith('vector_vector'):
self.imports.add("org.opencv.core.Mat")
self.imports.add("org.opencv.utils.Converters")
self.imports.add("java.util.List")
self.imports.add("java.util.ArrayList")
self.addImports(ctype.replace('vector_vector', 'vector'))
elif ctype.startswith('Feature2D'): #added
self.imports.add("org.opencv.features2d.Feature2D") #added
elif ctype.startswith('vector'):
self.imports.add("org.opencv.core.Mat")
self.imports.add('java.util.ArrayList')
if type_dict[ctype]['j_type'].startswith('MatOf'):
self.imports.add("org.opencv.core." + type_dict[ctype]['j_type'])
else:
self.imports.add("java.util.List")
self.imports.add("org.opencv.utils.Converters")
self.addImports(ctype.replace('vector_', ''))
After these changes wrappers are generated successfully. However the main problem still remains, how to use these wrappers from Java )). For example SIFT.create() gives the pointer to a new SIFT class but calling any class method (for instance detect()) crashes Java. I also noticed that using MSER.create() directly from Java leads to the same crash.
So it looks like the problem is isolated to the way how Feature2D.create() methods are wrapped in Java. The solution seems to be the following (again, changing /opencv/modules/java/generator/gen_java.py):
Find the string:
ret = "%(ctype)s* curval = new %(ctype)s(_retval_);return (jlong)curval->get();" % { 'ctype':fi.ctype }
Replace it with the following:
ret = "%(ctype)s* curval = new %(ctype)s(_retval_);return (jlong)curval;" % { 'ctype':fi.ctype }
Rebuild the opencv. That is it, all create() methods will start working properly for all children of Feature2D class including experimental and non-free methods. FeatureDescriptor/DescriptorExtractor wrappers can be deprecated I think as Feature2D is much easier to use.
BUT! I'm not sure if the suggested fix is safe for other OpenCV modules. Is there a scenario when (jlong)curval needs to be dereferenced? It looks like the same fix was suggested already here.

Run an ABCL code that uses cl-cppre

With reference to my previous question,
Executing a lisp function from Java
I was able to call lisp code from Java using ABCL.
But the problem is, the already existing lisp code uses CL-PPCRE package.
I can not compile the code as it says 'CL-PPCRE not found'.
I have tried different approaches to add that package,
including
1) how does one compile a clisp program which uses cl-ppcre?
2)https://groups.google.com/forum/#!topic/cl-ppcre/juSfOhEDa1k
Doesnot work!
Other thing is, that executing (compile-file aima.asd) works perfectly fine although it does also require cl-pprce
(defpackage #:aima-asd
(:use :cl :asdf))
(in-package :aima-asd)
(defsystem aima
:name "aima"
:version "0.1"
:components ((:file "defpackage")
(:file "main" :depends-on ("defpackage")))
:depends-on (:cl-ppcre))
The final java code is
interpreter.eval("(load \"aima/asdf.lisp\")");
interpreter.eval("(compile-file \"aima/aima.asd\")");
interpreter.eval("(compile-file \"aima/defpackage.lisp\")");
interpreter.eval("(in-package :aima)");
interpreter.eval("(load \"aima/aima.lisp\")");
interpreter.eval("(aima-load 'all)");
The error message is
Error loading C:/Users/Administrator.NUIG-1Z7HN12/workspace/aima/probability/domains/edit-nets.lisp at line 376 (offset 16389)
#<THREAD "main" {3A188AF2}>: Debugger invoked on condition of type READER-ERROR
The package "CL-PPCRE" can't be found.
[1] AIMA(1):
Can anyone help me?
You need to load cl-ppcre before you can use it. You can do that by using (asdf:load-system :aima), provided that you put both aima and cl-ppcre into locations that your ASDF searches.
I used QuickLisp to add cl-ppcre (because nothing else worked for me).
Here is what I did
(load \"~/QuickLisp.lisp\")")
(quicklisp-quickstart:install)
(load "~/quicklisp/setup.lisp")
(ql:quickload :cl-ppcre)
First 2 lines are only a one time things. Once quickLisp is installed you can start from line 3.

Owl2Java Code generation issue

I'm using the owl2java plugin to generate Java code from an Ontology file. But I'm always getting de same error.
Exception in thread "main" com.hp.hpl.jena.ontology.ConversionException: Cannot convert node http://www.w3.org/2002/07/owl#bottomObjectProperty to TransitiveProperty
at com.hp.hpl.jena.ontology.impl.TransitivePropertyImpl$1.wrap(TransitivePropertyImpl.java:66)
at com.hp.hpl.jena.enhanced.EnhNode.convertTo(EnhNode.java:142)
at com.hp.hpl.jena.enhanced.EnhNode.convertTo(EnhNode.java:22)
at com.hp.hpl.jena.enhanced.Polymorphic.asInternal(Polymorphic.java:54)
at com.hp.hpl.jena.enhanced.EnhNode.viewAs(EnhNode.java:92)
at com.hp.hpl.jena.enhanced.EnhGraph.getNodeAs(EnhGraph.java:135)
at com.hp.hpl.jena.ontology.impl.OntModelImpl$SubjectNodeAs.map1(OntModelImpl.java:3040)
at com.hp.hpl.jena.ontology.impl.OntModelImpl$SubjectNodeAs.map1(OntModelImpl.java:3033)
at com.hp.hpl.jena.util.iterator.Map1Iterator.next(Map1Iterator.java:35)
at com.hp.hpl.jena.util.iterator.WrappedIterator.next(WrappedIterator.java:68)
at com.hp.hpl.jena.util.iterator.UniqueExtendedIterator.nextIfNew(UniqueExtendedIterator.java:61)
at com.hp.hpl.jena.util.iterator.UniqueExtendedIterator.hasNext(UniqueExtendedIterator.java:69)
at com.hp.hpl.jena.util.iterator.NiceIterator.asList(NiceIterator.java:185)
at com.hp.hpl.jena.util.iterator.NiceIterator.toList(NiceIterator.java:159)
at de.incunabulum.owl2java.core.generator.OwlReader.handleProperties(OwlReader.java:862)
at de.incunabulum.owl2java.core.generator.OwlReader.generateJModel(OwlReader.java:457)
at de.incunabulum.owl2java.core.JenaGenerator.generate(JenaGenerator.java:65)
at onto.main.main(main.java:99)
I have no idea about what I'm doing wrong. Any Ideas?
Thanks you a lot.
I looked at the top line on your exception, and see com.hp.hpl.jena.ontology.impl.TransitivePropertyImpl.
Googling for that leads to a version of the source code. It may not be exactly the same version as you're using, but is probably close enough to be informative. Reading the code leads to these questions:
Does your Model have a profile? It must.
Does the profile support Transitivity? It must.
Are you combining Transitive with something else that it's incompatible with?

No Such method error during transformation to pdf in Java

I have a problem while transforming the xslt to pdf in java, i am following the same process posted in this link
"Java Transformation to PDF".
Error:
`
Caused by: java.lang.NoSuchMethodError: org.apache.xmlgraphics.java2d.GraphicContext.<init>(Lorg/apache/xmlgraphics/java2d/GraphicContext;)V
at org.apache.fop.render.intermediate.IFGraphicContext.<init>(IFGraphicContext.java:50)
at org.apache.fop.render.intermediate.IFGraphicContext.clone(IFGraphicContext.java:56)
at org.apache.fop.render.intermediate.IFRenderer.saveGraphicsState(IFRenderer.java:632)
at org.apache.fop.render.intermediate.IFRenderer.startViewport(IFRenderer.java:885)
at org.apache.fop.render.intermediate.IFRenderer.startVParea(IFRenderer.java:878)
at org.apache.fop.render.AbstractRenderer.renderRegionViewport(AbstractRenderer.java:289)
at org.apache.fop.render.intermediate.IFRenderer.renderRegionViewport(IFRenderer.java:731)
at org.apache.fop.render.AbstractRenderer.renderPageAreas(AbstractRenderer.java:249)
at org.apache.fop.render.AbstractRenderer.renderPage(AbstractRenderer.java:230)
at org.apache.fop.render.intermediate.IFRenderer.renderPage(IFRenderer.java:580)
at org.apache.fop.area.RenderPagesModel.addPage(RenderPagesModel.java:114)
at org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage(AbstractPageSequenceLayoutManager.java:312)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequenceLayoutManager.java:167)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:109)
at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)
at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)
at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)
at net.sf.saxon.event.ContentHandlerProxy.endElement(ContentHandlerProxy.java:391)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:174)
at net.sf.saxon.event.NamespaceReducer.endElement(NamespaceReducer.java:213)
at net.sf.saxon.event.ComplexContentOutputter.endElement(ComplexContentOutputter.java:417)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:301)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:409)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:94)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:298)
at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:175)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:343)
at net.sf.saxon.Controller.transformDocument(Controller.java:1736)
at net.sf.saxon.Controller.transform(Controller.java:1560)
at mypackage.v2.business.pdf.XMLtoPDF.convertXMLPDF(XMLtoPDF.java:103)
... 51 more
java.lang.ClassCastException: java.lang.NoSuchMethodError cannot be cast to java.lang.Exception
`
Please let me know what could be the problem.
As described in the documentation
Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method.
Here's how this can happen. Imagine you built some code that used a library with a method called foo(). You compiled your project and then later decided to upgrade the library. You do this by overwriting the old jar file with the new one. You don't recompile your code.
But what you didn't know is the new library removed the foo() method. Now if you run your code, it will throw this exception because your compile code calls this method and it's no longer there.
In your specific case, this isn't necessarily your code with the problem. It could be that you have one library that uses another library and the problem is there (for example, Library X uses version 2 of Library Y, but you only have Library Y version 1 in your classpath). If this is happening, you need to make sure the libraries are using the version they expect.
For your specific problem, you need to find the version of the jar that has org.apache.xmlgraphics.java2d.GraphicContext in it and it needs to have a constructor that takes a... list of org/apache/xmlgraphics/java2d/GraphicContext... maybe. I forget what (L...;)V means.

clock animation in javafx programming

i'm john i'm newbie in javafx programming. i have several querstion that i don't
understand from this code (this code is using for create animation time) :
check this link for detail :
check this out
first :
there is two source code, what shouls i do? i'm really beginer in javafx programming, should i to create new package or new class or what? i'm currently use NET BEANS 7.2 ?
second :
i choose new class than I copied your code into my "JAVAFX application project" (is that right ?) than i have 2 file first is analogclock.java and the second one is analogclockwork.java than i got 3 error,
in analogclock.java i found error in this code
- clockwork.hourHandAngle()
- clockwork.minuteHandAngle()
- clockwork.minuteHandAngle()
error -> "Cannot find symbol, symbol : method minuteHandAngle()
location: variable clockwork of type AnalogClock
----"
can you help me? i really need your help for my colage work.
thanks for your help, i’m really appreciate it.
note :
i think i create class in same package (javafxapplication 5 package in my case)
sorry i really new in javafx programming and actually i never use netbeans 7.2, i got this task from my lecture. i don't unserstand in your point 3,4,5 particularly in point 4, this is my project properties :
- AnalogClock
- Source Packages
- AnalogClock
- AnalogClock.java
- se.crisp.clock
- AnalogClockwork.java
-libraries
- Default JavaFx Platform
is that right?
i think i create class in same package (javafxapplication 5 package in my case)
- You should not do that.
Seems you have missed a class in your package.
Do this :-
Create New Project lets name it AnalogClock
create new package under source packages and name it se.crisp.clock (from the above example)
Copy all the classes one by one and add under the above package. Use the same class name.
Add javafx related jars in project -> properties -> library
Clean and build & Run

Categories

Resources