把底层库打包进JAR的方法_第1页
把底层库打包进JAR的方法_第2页
把底层库打包进JAR的方法_第3页
把底层库打包进JAR的方法_第4页
把底层库打包进JAR的方法_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

把底层库打包进 JAR的方法[1/3] 背景最近用到 JavaCV做直播项目,在从 github上下载了一个叫RtmpRecoder的项目时,发现RtmpRecoder用到了通过JavaCV运用到ffmpeg,于是下载了JavaCV-bin(javacv-1.2-src.zip),解压后发现里面只有jar包,却没有发现任何底层库----没有底层库怎么调到ffmpeg那?带着这个疑问, 按照《【JavaCV与Android】在Android工程里配置 JavaCV》里介绍的,解压了其中一个 jar文件ffmpeg-android-arm.jar,在目录javacv-bin/ffmpeg-android-arm/lib/armeabi 下果然发现有一堆动态库。第一次见到 JAR包中也可以包含底层库,很惊奇,就想知道是怎么做到的。就 google搜索了下,发现可以运用Jar2Lib和jace技术生成。此外,JavaCPP技术能便捷的实现把底层库打包进 JAR,能部分代替 JNI技术(但是不能代替底层回调Java层)。在此,贴出具体方法,以备查阅。 [2/3][转]JaceandJar2LibJar2LibLatestVersionJar2LibisacommandlinetoolforgeneratingC++wrapperlibrariesaroundJavaJARfiles.ItexposestheentirepublicJavaAPIoftheJARinthecorrespondingC++sharedlibrary,delegatingtoJavaviaJNI.ThewrappingisperformedusingJace.WeuseJar2LibtogeneratetheBF-CPPbindingsforBio-Formats,whichweuseinourWiscScanacquisitionsoftware.Historicalnote:Jar2LibwasoriginallydevelopedtointegrateBio-FormatswiththeInsightToolkit,forusewiththeFARSIGHTproject.However,wenowhaveandedicatedinter-processsolutionforITKintegrationinsteadwhichiseasiertobuildfromsource,sinceithasnocompile-timedependencies.Nonetheless,BF-CPPisstilltherecommendedin-processsolutionforBio-Formatsnativecodeintegration.Downloadjace-r39.jarWerecommendusingJar2Libviathecppwrap-maven-plugin;see"Installationandusage"below.IfyouprefertouseJar2LibdirectlyfromthecommandlineoutsideMaven:DownloadtheJARslinkedabove,aswellasApacheVelocity1.7anditsdependencies.WithallnecessaryJARsinyourcurrentworkingdirectory,youcanrunJar2Libonthecommandlineasfollows:library.jar[library2.jar...][-conflictsconflicts.txt][-headerheader.txt][-extrascmake_extras.txt][-output/path/to/output-project][-corejava_core_classes.txtLanguageJavaSourceCodejar2libInstallationandUsageTheeasiestwaytouseJar2LibisviaourcppwrapMavenplugin,whichtakesadvantageoftheMavenplug-ininfrastructuretoeasilyconvertaJavalibrarytoC++usingJar2Lib,withoutrequiringanyknowledgeofJar2Lib'sworkingsorsyntax.Forexample,itcircumventsanyneedtodownloadtransitivedependencies.更详细信息,请参考网址技术JavaCPP

是一个开源库,它提供了在

Java

中高效访问本地C++的方法。采用

JNI

技术实现,所以支持所有

Java

实现包括 Android 系统,Avian和RoboVM。3.1JavaCPPPresets--PrebuiltJavaBindingstoC/C++LibrariesThesearepartofaprojectthatwecalltheJavaCPPPresets.ManycoexistinthesameGitHubrepository,andalluseJavaCPPtowrappredefinedC/C++librariesfromopen-sourceland.ThebindingsexposealmostalloftherelevantAPIsandmakethemavailableinaportableanduser-friendlyfashiontoanyJavavirtualmachine(includingAndroid),asiftheywerelikeanyothernormalJavalibraries.WehavepresetsforthefollowingC/C++libraries:OpenCV–[sampleusage]–Morethan2500optimizedcomputervisionandmachinelearningalgorithmsFFmpeg–[sampleusage]–Acomplete,cross-platformsolutiontorecord,convertandstreamaudioandvideoFlyCapture–[sampleusage]–Imageacquisitionandcameracontrolsoftwarelibdc1394–[sampleusage]–Ahigh-levelAPIforDCAM/IIDCcamerasOpenKinect–[sampleusage]–OpensourcelibrarytousetheXboxKinectvideoInput–[sampleusage]–AfreeWindowsvideocapturelibraryARToolKitPlus –[sampleusage]–Marker-basedaugmentedrealitytrackinglibraryChilitags–[sampleusage]–Robustfiducialmarkersforaugmentedrealityandroboticsflandmark–[sampleusage]–Open-sourceimplementationoffaciallandmarkdetectorFFTW–[sampleusage]–FastcomputingofthediscreteFouriertransform(DFT)inoneormoredimensionsGSL–[sampleusage]–TheGNUScientificLibrary,anumericallibraryforCandC++programmersLLVM–[sampleusage]–AcollectionofmodularandreusablecompilerandtoolchaintechnologiesLeptonica–[sampleusage]–SoftwareusefulforimageprocessingandimageanalysisapplicationsTesseract–[sampleusage]–ProbablythemostaccurateopensourceOCRengineavailableCaffe–[sampleusage]–AfastopenframeworkfordeeplearningCUDA –[sampleusage]–ArguablythemostpopularparallelcomputingplatformforGPUsMXNet –[sampleusage]–FlexibleandefficientlibraryfordeeplearningTensorFlow–[sampleusage]–ComputationusingdataflowgraphsforscalablemachinelearningAddhereyourfavoriteC/C++library,forexample:OpenNI,OpenMesh,PCL,etc.Readabouthowtodo

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论