I am getting the below error while building android app
In file included from C:\Users\ItsMe\Downloads\PhotoLab\opencv\libcxx_helper\DetectionBasedTracker_jni.cpp:1:
In file included from C:\Users\ItsMe\Downloads\PhotoLab\opencv\libcxx_helper\DetectionBasedTracker_jni.h:4:
In file included from C:\Users\ItsMe\Downloads\PhotoLab\opencv\libcxx_helper\ModelClass.h:4:
C:\Users\ItsMe\AppData\Local\Android\Sdk\ndk\21.1.6352462\toolchains\llvm\prebuilt\windows-x86_64\lib64\clang\9.0.8\include\opencl-c.h:9063:20: error: exception specification in declaration does not match previous declaration
I am using a cmakeList.txt file which handle everything you can check it below
cmake_minimum_required(VERSION 3.10)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_ANDROID_STL_TYPE "c++_static")
set(CMAKE_CXX_STANDARD 11)
set(libs "/Users/ItsMe/Downloads/Compressed/opencv-4.7.0-android-sdk_3/OpenCV-android-sdk/sdk/native/libs")
set(staticlibs "/Users/ItsMe/Downloads/Compressed/opencv-4.7.0-android-sdk_3/OpenCV-android-sdk/sdk/native/staticlibs")
include_directories(/Users/ItsMe/Downloads/Compressed/opencv-4.7.0-android-sdk_3/OpenCV-android-sdk/sdk/native/jni/include)
#-----------------adding libraries-------------------------
add_library(libopencv_java4 SHARED IMPORTED )
set_target_properties(libopencv_java4 PROPERTIES
IMPORTED_LOCATION "${libs}/${ANDROID_ABI}/libopencv_java4.so")
add_library(libopencv_core STATIC IMPORTED )
set_target_properties(libopencv_core PROPERTIES
IMPORTED_LOCATION "${staticlibs}/${ANDROID_ABI}/libopencv_core.a")
add_library(detection_based_tracker SHARED
DetectionBasedTracker_jni.cpp 3DFaceModel.cpp 3DFaceModel.h OrthogonalProjectionModel.cpp OrthogonalProjectionModel.h ObjectiveFunctionHelper.cpp ObjectiveFunctionHelper.h Shape2D.cpp Shape2D.h ObjectiveFunction.cpp ObjectiveFunction.h TestObjectiveFunction.cpp TestObjectiveFunction.h FaceFollower.cpp FaceFollower.h FaceFinder.cpp FaceFinder.h LandmarkDetector.cpp LandmarkDetector.h
)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -fexceptions -frtti")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ")
set(OpenCV_DIR "/Users/ItsMe/Downloads/Compressed/opencv-4.7.0-android-sdk_3/OpenCV-android-sdk/sdk/native/jni")
#find_package(OpenCV REQUIRED)
message(STATUS "OpenCV libraries: ${OpenCV_LIBS}")
target_link_libraries(detection_based_tracker
# ${OpenCV_LIBS}
libopencv_java4
libopencv_core
android
# log
)
I am expecting a solution as i am getting error in NDK files as you can see image
Related
I am trying to include a C++ library with my swing project..
When I compile the jnilib/so, with stdio.h it works fine for this:
gcc -shared -o libhello.jnilib hello.c -fPIC -I/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/include/darwin
I am trying to import and need to use gnu-libstdc++/4.9
How do I link my java project?
When I try to build the jni file:
It will throw this:
test.c:5:10: fatal error: 'string' file not found
#include <string>
EDIT
Now when I link to this:
-I /Users/tnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include
It throws this error:
...
/Users/tnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include/bits/ctype_base.h:69:37: error: use of undeclared identifier '_U'
static const mask graph = _P | _U | _L | _N;
^
/Users/tnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include/bits/ctype_base.h:69:42: error: use of undeclared identifier '_L'
static const mask graph = _P | _U | _L | _N;
^
/Users/tnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include/bits/ctype_base.h:69:47: error: use of undeclared identifier '_N'
static const mask graph = _P | _U | _L | _N;
^
/Users/tnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include/bits/ctype_base.h:70:32: error: use of undeclared identifier '_C'
static const mask cntrl = _C;
^
/Users/tnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include/bits/ctype_base.h:71:32: error: use of undeclared identifier '_P'
static const mask punct = _P;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
EDIT2
After adding -I /Users/timnuwin/Documents/ndk/android-ndk-r12b/platforms/android-17/arch-x86/usr/include now it throws:
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cwchar:164:11: error: no member named 'vfwscanf' in the global namespace
using ::vfwscanf;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cwchar:170:11: error: no member named 'vswscanf' in the global namespace
using ::vswscanf;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cwchar:174:11: error: no member named 'vwscanf' in the global namespace
using ::vwscanf;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cwchar:191:11: error: no member named 'wcstof' in the global namespace
using ::wcstof;
~~^
In file included from hello.cpp:6:
In file included from /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/sstream:38:
In file included from /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/istream:38:
In file included from /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/ios:44:
In file included from /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/basic_ios.h:37:
In file included from /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/locale_facets.h:39:
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cwctype:89:11: error: no member named 'iswblank' in the global namespace; did you
mean 'isblank'?
using ::iswblank;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/platforms/android-17/arch-x86/usr/include/ctype.h:88:5: note: 'isblank' declared here
int isblank(int);
^
1 warning and 5 errors generated.
EDIT3
Okay I think I'm a little closer here's the updated includes...
gcc -shared -o libhello.jnilib hello.cpp -fPIC
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/include
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/include/darwin
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/bits
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/debug
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/decimal
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/experimental
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/ext
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/parallel
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/profile
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/tr1
-I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/tr2
But now it throws:
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/tr1/stdio.h:8:10: fatal error: 'tr1/cstdio' file not found
#include
EDIT
Alrighty, setting the include to be the base dir include -I /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include now throws:
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cstdio:98:11: error: no member named 'FILE' in the global namespace
using ::FILE;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cstdio:99:11: error: no member named 'fpos_t' in the global namespace
using ::fpos_t;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cstdio:101:11: error: no member named 'clearerr' in the global namespace
using ::clearerr;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cstdio:102:11: error: no member named 'fclose' in the global namespace
using ::fclose;
~~^
/Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/cstdio:103:11: error: no member named 'feof' in the global namespace
using ::feof;
~~^
clang++ -shared -o libhello.jnilib hello.cpp -fPIC -funwind-tables -no-canonical-prefixes -fexceptions -frtti -Os -g -DNDEBUG -DNDEBUG -fPIC -std=gnu++11 -I/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/include/darwin -isystem /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include -isystem /Users/timnuwin/Documents/ndk/android-ndk-r12b/sources/cxx-stl/gnu-libstdc++/4.9/include/backward -I /Users/timnuwin/Documents/ndk/android-ndk-r12b/platforms/android-17/arch-x86/usr/include
That cmd was able to create my jnilib file. :D 3 days later hehe
I've tried to clean and build my project, but when I double-click on the executable jar file nothing happens. I have these settings enabled:
This is essentially an inventory manager application with an embedded Apache Derby database developed using Hibernate within the NetBeans IDE.
Here are my libraries:
And here is the folder structure:
When I run the following command jar tf filename.jar in the cmd.exe:
C:\Projects\InternalAssessment_Hibernated\dist>jar tf InternalAssessment.jar
META-INF/
META-INF/MANIFEST.MF
DAO/
classes/
delivery/
delivery/view/
internalassessment/
main/
main/view/
miscellaneous/
miscellaneous/view/
partner/
partner/view/
report/
report/view/
setlimit/
setlimit/view/
stock/
stock/view/
DAO/AbstractModel.class
DAO/AdvicenoteModel.class
DAO/CategoryModel.class
DAO/HibernateUtil.class
DAO/ItemModel.class
DAO/Ledger.class
DAO/PartnerModel.class
DAO/TransactionModel.class
classes/Advicenote.class
classes/Advicenote.hbm.xml
classes/Categories.class
classes/Categories.hbm.xml
classes/Items.class
classes/Items.hbm.xml
classes/Limit.class
classes/Limit.hbm.xml
classes/Partner.class
classes/Partner.hbm.xml
classes/Transactions.class
classes/Transactions.hbm.xml
delivery/view/Delivery$1.class
delivery/view/Delivery$2.class
delivery/view/Delivery$3.class
delivery/view/Delivery$4.class
delivery/view/Delivery$5.class
delivery/view/Delivery$6.class
delivery/view/Delivery$7.class
delivery/view/Delivery.class
delivery/view/Selection$1.class
delivery/view/Selection$2.class
delivery/view/Selection$3.class
delivery/view/Selection$4.class
delivery/view/Selection.class
delivery/view/Transfer$1.class
delivery/view/Transfer$2.class
delivery/view/Transfer$3.class
delivery/view/Transfer$4.class
delivery/view/Transfer$5.class
delivery/view/Transfer$6.class
delivery/view/Transfer$7.class
delivery/view/Transfer.class
hibernate.cfg.xml
internalassessment/Webp.net-resizeimage (4).png
internalassessment/about.png
internalassessment/add_database.png
internalassessment/answers.png
internalassessment/banner.png
internalassessment/conference_call.png
internalassessment/database.png
internalassessment/delete_database.png
internalassessment/empty_filter.png
internalassessment/engflag.png
internalassessment/external.png
internalassessment/hibernate.png
internalassessment/high_priority.png
internalassessment/hunflag.png
internalassessment/in_transit.png
internalassessment/internal.png
internalassessment/list.png
internalassessment/netbeans.png
internalassessment/search.png
internalassessment/shipped.png
internalassessment/sms.png
internalassessment/synchronize.png
internalassessment/todo_list.png
internalassessment/view_details.png
main/view/Bundle.properties
main/view/Bundle_hu_HU.properties
main/view/MainMenu$1.class
main/view/MainMenu$FormListener.class
main/view/MainMenu.class
miscellaneous/view/Contents$1$1.class
miscellaneous/view/Contents$1.class
miscellaneous/view/Contents.class
miscellaneous/view/Tutorial$1$1.class
miscellaneous/view/Tutorial$1.class
miscellaneous/view/Tutorial.class
partner/view/AddPartner$1$1.class
partner/view/AddPartner$1.class
partner/view/AddPartner$FormListener.class
partner/view/AddPartner.class
partner/view/ModifyPartner$1$1.class
partner/view/ModifyPartner$1.class
partner/view/ModifyPartner$FormListener.class
partner/view/ModifyPartner.class
partner/view/PartnerView$1.class
partner/view/PartnerView$FormListener.class
partner/view/PartnerView.class
report/view/ReportView$1.class
report/view/ReportView$FormListener.class
report/view/ReportView$TableModel.class
report/view/ReportView.class
setlimit/view/LimitMessage$1.class
setlimit/view/LimitMessage.class
setlimit/view/SetQunatityLimit$1.class
setlimit/view/SetQunatityLimit$2.class
setlimit/view/SetQunatityLimit$3.class
setlimit/view/SetQunatityLimit.class
stock/view/AddCategory$1$1.class
stock/view/AddCategory$1.class
stock/view/AddCategory$FormListener.class
stock/view/AddCategory.class
stock/view/AddItem$1$1.class
stock/view/AddItem$1.class
stock/view/AddItem$FormListener.class
stock/view/AddItem.class
stock/view/CategoryView$1.class
stock/view/CategoryView$FormListener.class
stock/view/CategoryView.class
stock/view/ModifyCategory$1$1.class
stock/view/ModifyCategory$1.class
stock/view/ModifyCategory$FormListener.class
stock/view/ModifyCategory.class
stock/view/ModifyItem$1$1.class
stock/view/ModifyItem$1.class
stock/view/ModifyItem$FormListener.class
stock/view/ModifyItem.class
stock/view/StockView$1.class
stock/view/StockView$2.class
stock/view/StockView$FormListener.class
stock/view/StockView$ItemAndQuantity.class
stock/view/StockView.class
But when I try to extract the manifest META-INF/MANIFEST.MF the contents aren't displayed:
C:\Projects\InternalAssessment_Hibernated\dist>jar tf InternalAssessment.jar META-INF/MANIFEST.MF
META-INF/MANIFEST.MF
C:\Projects\InternalAssessment_Hibernated\dist>
I don't know what could be wrong with my application, any help would be appriciated! It's my first time using apache Derby and Hibernate, so I am essentially clueless.
Also, here is my project.properties file, I hope it will help:
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=InternalAssessment
application.vendor=Méri Marcell
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/InternalAssessment.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/InternalAssessment
endorsed.classpath=
excludes=
file.reference.antlr-2.7.7.jar=lib/antlr-2.7.7.jar
file.reference.byte-buddy-1.9.5.jar=lib/byte-buddy-1.9.5.jar
file.reference.classmate-1.3.4.jar=lib/classmate-1.3.4.jar
file.reference.derby.jar=lib/derby.jar
file.reference.dom4j-2.1.1.jar=lib/dom4j-2.1.1.jar
file.reference.FastInfoset-1.2.15.jar=lib/FastInfoset-1.2.15.jar
file.reference.hibernate-commons-annotations-5.1.0.Final.jar=lib/hibernate-commons-annotations-5.1.0.Final.jar
file.reference.hibernate-core-5.4.1.Final.jar=lib/hibernate-core-5.4.1.Final.jar
file.reference.istack-commons-runtime-3.0.7.jar=lib/istack-commons-runtime-3.0.7.jar
file.reference.jandex-2.0.5.Final.jar=lib/jandex-2.0.5.Final.jar
file.reference.javassist-3.24.0-GA.jar=lib/javassist-3.24.0-GA.jar
file.reference.javax.activation-api-1.2.0.jar=lib/javax.activation-api-1.2.0.jar
file.reference.javax.persistence-api-2.2.jar=lib/javax.persistence-api-2.2.jar
file.reference.jaxb-api-2.3.1.jar=lib/jaxb-api-2.3.1.jar
file.reference.jaxb-runtime-2.3.1.jar=lib/jaxb-runtime-2.3.1.jar
file.reference.jboss-logging-3.3.2.Final.jar=lib/jboss-logging-3.3.2.Final.jar
file.reference.jboss-transaction-api_1.2_spec-1.1.1.Final.jar=lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar
file.reference.stax-ex-1.8.jar=lib/stax-ex-1.8.jar
file.reference.txw2-2.3.1.jar=lib/txw2-2.3.1.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.FastInfoset-1.2.15.jar}:\
${file.reference.antlr-2.7.7.jar}:\
${file.reference.byte-buddy-1.9.5.jar}:\
${file.reference.classmate-1.3.4.jar}:\
${file.reference.derby.jar}:\
${file.reference.dom4j-2.1.1.jar}:\
${file.reference.hibernate-commons-annotations-5.1.0.Final.jar}:\
${file.reference.hibernate-core-5.4.1.Final.jar}:\
${file.reference.istack-commons-runtime-3.0.7.jar}:\
${file.reference.jandex-2.0.5.Final.jar}:\
${file.reference.javassist-3.24.0-GA.jar}:\
${file.reference.javax.activation-api-1.2.0.jar}:\
${file.reference.javax.persistence-api-2.2.jar}:\
${file.reference.jaxb-api-2.3.1.jar}:\
${file.reference.jaxb-runtime-2.3.1.jar}:\
${file.reference.jboss-logging-3.3.2.Final.jar}:\
${file.reference.jboss-transaction-api_1.2_spec-1.1.1.Final.jar}:\
${file.reference.stax-ex-1.8.jar}:\
${file.reference.txw2-2.3.1.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}:\
${libs.eclipselink.classpath}
javac.source=11
javac.target=11
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=InternalAssessment
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
main.class=main.view.MainMenu
# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
manifest.custom.application.library.allowable.codebase=
# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts.
manifest.custom.caller.allowable.codebase=
# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed
manifest.custom.codebase=
# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions)
manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
I am trying to re-compile one of the .Java file in Oracle 11g and I am getting the below error:
$ . /dboracle/orabase/product/11.2.0.BTSP8/bin/loadjava -verbose -resolve -synonym -user nm/nm -grant PUBLIC DeviceAttribParserConstants.java
arguments: '-user' 'nm/***' '-verbose' '-resolve' '-synonym' '-grant' 'PUBLIC' ' DeviceAttribParserConstants.java'
creating : source com/bt/nmsloader/model/DeviceAttribParserConstants
loading : source com/bt/nmsloader/model/DeviceAttribParserConstants
Error while creating source com/bt/nmsloader/model/DeviceAttribParserConstants
ORA-29542: class com/bt/nmsloader/model/DeviceAttribParserConstants already defined by source DeviceAttribParserConstants/java
ORA-06512: at line 1
The following operations failed
source com/bt/nmsloader/model/DeviceAttribParserConstants: creation (createFailed)
exiting : Failures occurred during processing
When I have looked in the ALL_Objects meta-dictionary I did not found JAVA SOURCE but can only see JAVA CLASS for DeviceAttribParserConstants.
Now when I am trying to recompile then I am getting above error and if I am dropping the same JAVA class file then I am getting error as below:
ORA-29537: class or resource cannot be created or dropped directly.
ORA-06512: at line1
* Cause: An attempt was made to create or drop JAVA class or resources that is a known result from compilation of an existing JAVA Source object.
I am stuck. Can someone help me in resolving this error.
Many thanks in advance.
Regards,
Himmy Chauhan
Can we delete records from Meta Dictionary
You shouldn't as it is likely to corrupt your database.
Now when I am trying to recompile then I am getting above error and if I am dropping the same JAVA class file then I am getting error as below:
ORA-29537: class or resource cannot be created or dropped directly.
ORA-06512: at line1
* Cause: An attempt was made to create or drop JAVA class or resources that is a known result from compilation of an existing JAVA Source object.
The loadjava utility has a force option:
-force Forces files to be loaded, even if they match digest table entries.
So you can try:
loadjava -verbose -force -resolve -synonym -user nm/nm -grant PUBLIC DeviceAttribParserConstants.java
You can also try to drop the existing java object:
SELECT OWNER, OBJECT_NAME
FROM ALL_OBJECTS
WHERE OWNER = 'NM'
AND OBJECT_NAME LIKE '%DeviceAttribParserConstants';
DROP JAVA CLASS NM.<insert_object_name>
and then try using loadjava without the force option.
(You may want to try backing up the existing class file before you drop/overwrite it just in case you need to revert to the prior version.)
I'm trying to connect to Teradata through RStudio, but for some reason JDBC function has problems recognizing the path where Java drivers sit. See the code below:
library(RODBC)
library(RJDBC)
library(rJava)
# both Java drivers definitely exist
file.exists('/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar')
[1] TRUE
file.exists('/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar')
[1] TRUE
But when I paste those paths in JDBC call...
# allow more elaborated error messages to appear
.jclassLoader()$setDebug(1L)
drv = JDBC("com.teradata.jdbc.TeraDriver","/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar")
... I get the following error:
RJavaClassLoader: added
'/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar'
to the URL class path loader WARNING: the path
'/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar'
does NOT exist, it will NOT be added to the internal class path!
RJavaClassLoader: added
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar'
to the URL class path loader RJavaClassLoader: adding Java archive
file
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar'
to the internal class path
RJavaClassLoader#3d4eac69.findClass(com.teradata.jdbc.TeraDriver)
- URL loader did not find it: java.lang.ClassNotFoundException: com.teradata.jdbc.TeraDriver
RJavaClassLoader.findClass("com.teradata.jdbc.TeraDriver")
- trying class path "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/java"
Directory, can get
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/java/com/teradata/jdbc/TeraDriver.class'?
NO
- trying class path "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar"
JAR file, can get 'com/teradata/jdbc/TeraDriver'? NO
ClassNotFoundException Error in .jfindClass(as.character(driverClass)[1]) : class not found
Running the same code in R, rather than RStudio, returns the same error.
Also, re-installing RJDBC package (as suggested here) didn't solve the issue.
Can anyone explain why this is happening? Thanks for help.
Here's my session info:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.13.4 RJDBC_0.2-7 rJava_0.9-9 DBI_0.8 RODBC_1.3-15
[6] dplyr_0.7.4 readr_1.1.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.15 bindr_0.1 magrittr_1.5 hms_0.3 R6_2.2.2
[6] rlang_0.1.6 httr_1.3.1 tools_3.4.1 git2r_0.19.0 withr_2.1.1.9000
[11] yaml_2.1.16 assertthat_0.2.0 digest_0.6.15 tibble_1.4.2 bindrcpp_0.2
[16] curl_3.0 memoise_1.1.0 glue_1.2.0 compiler_3.4.1 pillar_1.1.0
[21] pkgconfig_2.0.1
That's a mistake in the path - you have inadvertently pasted two paths together (note the semicolon between the paths). You probably intended
drv <- JDBC("com.teradata.jdbc.TeraDriver",
c("/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar",
"/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar"))
note that you probably can make your life easier by simply using
drv <- JDBC("com.teradata.jdbc.TeraDriver", Sys.glob("/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/*.jar"))
This worked for me. Just make sure that both jars are located in the referenced directory.
library(RJDBC)
drv <- RJDBC::JDBC(driverClass = "com.teradata.jdbc.TeraDriver", classPath = Sys.glob("~/drivers/teradata/*"))
conn <- dbConnect(drv,'jdbc:teradata://<server>/<db>',"un","pw")
result.df<- dbGetQuery(conn,"select * from table")
I'd like to use Clojure code within Java. The Clojure code itself should implement a Java-interface (TestGenClassInterface).
My project.clj is:
(defproject com.stackoverflow.clojure/tests "0.1.0-SNAPSHOT"
:description "Tests of Clojure test-framework."
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[instaparse "1.3.4"]]
:source-paths ["src/main/clojure"]
:java-source-paths ["src/main/java"]
:test-paths ["src/test/clojure"]
:java-test-paths ["src/test/java"]
;:aot :all
)
The Java interface looks like this:
package com.stackoverflow.clojure;
public interface TestGenClassInterface {
public String addToString(String text, String appendText);
}
The Clojure code is:
(ns com.stackoverflow.clojure.testGenClass
(:gen-class
:name com.stackoverflow.clojure.TestGenClass
:implements com.stackoverflow.clojure.TestGenClassInterface
:prefix "java-"))
(def ^:private pre "START: ")
(defn java-addToString [this text post]
(str pre text post))
(java-addToString "TexT" " :END")
I expected, that after running lein compile or "Run as Clojure-Application" in eclipse+CounterClockwise a .class file (named TestGenClass.class) is generated an saved within *compile-path* (here: target/classes/com/stackoverflow/clojure/). Unfortunately it's not.
When adding :aot :all to my project.clj, I get the following stacktrace:
Compiling com.stackoverflow.clojure.testGenClass
Exception in thread "main" java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol, compiling:(com/stackoverflow/clojure/testGenClass.clj:1:1)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6651)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5782)
at clojure.lang.Compiler$TryExpr$Parser.parse(Compiler.java:2191)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6644)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5782)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5217)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3846)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6642)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6632)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3665)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6646)
at clojure.lang.Compiler.analyze(Compiler.java:6445)
at clojure.lang.Compiler.analyze(Compiler.java:6406)
at clojure.lang.Compiler.compile1(Compiler.java:7221)
at clojure.lang.Compiler.compile1(Compiler.java:7216)
at clojure.lang.Compiler.compile(Compiler.java:7292)
at clojure.lang.RT.compile(RT.java:398)
at clojure.lang.RT.load(RT.java:438)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
at clojure.core$compile$fn__5071.invoke(core.clj:5652)
at clojure.core$compile.invoke(core.clj:5651)
at user$eval9.invoke(form-init4595004281107083893.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.load(Compiler.java:7130)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$init_opt.invoke(main.clj:279)
at clojure.main$initialize.invoke(main.clj:307)
at clojure.main$null_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:420)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
at clojure.lang.RT.seqFrom(RT.java:505)
at clojure.lang.RT.seq(RT.java:486)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$map$fn__4245.invoke(core.clj:2551)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:484)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$map$fn__4245.invoke(core.clj:2551)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.Cons.next(Cons.java:39)
at clojure.lang.RT.boundedLength(RT.java:1654)
at clojure.lang.RestFn.applyTo(RestFn.java:130)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$mapcat.doInvoke(core.clj:2586)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at clojure.core$generate_class.invoke(genclass.clj:164)
at clojure.core$gen_class.doInvoke(genclass.clj:638)
at clojure.lang.RestFn.invoke(RestFn.java:1557)
at clojure.lang.Var.invoke(Var.java:519)
at clojure.lang.AFn.applyToHelper(AFn.java:270)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.lang.Compiler.macroexpand1(Compiler.java:6552)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6630)
... 46 more
Compilation failed: Subprocess failed
The proximate issue you have is a missing :aot :all in your project.clj file. Without that the ahead-of-time compilation will not be attempted.
Once you put that in, you'll have the following further issues:
you must prefix the names of the functions designated to become Java methods (default prefix is -);
you must include this as an explicit first argument of each such method (this is the recommended convention, but any name is acceptable);
you must correct your :implements clause: it takes a vector as the value, even if it has a single member.
According to http://clojure.org/compilation
... the implementation functions for instance methods will always take an
additional first arg corresponding to the object the method is called
upon, called by convention 'this' here.
Try adding 'this' to each function definition.
(defn java-addToString [this text post]
...
http://clojure.org/compilation mentions the compilation process makes use of
... *compile-path*, which must be in the classpath
The default location is a classes folder.
The second answer to Stack Overflow question Compiling Clojure? mentions that this path is relative to the jvm startup folder. If you did lein repl from the main project folder (the folder where project.clj lives) then creating a classes folder there should make it work.