准备在Eclipse中使用JNA [英] Preparing JNA for use in Eclipse

查看:449
本文介绍了准备在Eclipse中使用JNA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:
我正在进行机器学习研究,并希望使用 FANN 库构建神经网络。源代码用C编写,但我需要它包装,以便我可以使用它与我们创建的很多Java类。



问题:
该网站提供了一个链接到已经很受欢迎的包装软件fannj。它的依赖是FANN库源代码和JNA。我从来没有做过包装,所以JNA对我来说是全新的。您必须代码的github主页提及将jna.library.path系统属性设置为FANN库的路径。我目前正在Mac OS X中的Eclipse中尝试这样做。我之前提到的一个朋友,这意味着我必须将FANN库的位置作为参数传递给虚拟机,但他只能告诉我如何通过shell来做到这一点。我从来没有从shell运行这个命令,因为我不知道它会如何与之后的Eclipse中的任何配置相冲突。



如何在Eclipse中设置 jna.library.path ? JNA目录是巨大的,我不知道实际的可执行文件在哪里。我的朋友建议我通过使用参数选项卡来修改其运行配置,但是像我说的,我实际上并不知道可执行文件的位置。我所有的是大型未压缩的jar文件。如何在Eclipse中设置它?

解决方案

两个允许Eclipse使用JNA,您只需要做的就是将两个 jar文件放在Eclipse的Java Build Path,jna.jar和platform.jar中。为此,单击项目,在包资源管理器中右键单击项目,单击属性(在底部),单击Java构建路径左边,然后添加外部Jar文件。使用JNA文件浏览到目录并添加这两个文件。


Background: I'm doing machine learning research, and want to use the FANN library to construct neural networks. The source code is written in C, but I need it wrapped so that I can use it with a lot of Java classes we've created.

Question: The website provides a link to an already well received wrapper software called fannj. Its dependencies is the FANN library source code and JNA. I've never done wrapping before so JNA is brand new to me. The github homepage for the code mentions "you must set the jna.library.path system property to the path of the FANN Library". I'm currently in the process of trying to do this in Eclipse on Mac OS X. A friend of mine mentioned to me earlier that it means I have to pass the location of the FANN library as argument to the virtual machine, but he only showed me how to do this via the shell. I never actually ran this command from the shell, because I wasn't sure how it would conflict with whatever configurations I do in Eclipse later.

How do I set the jna.library.path in Eclipse? The JNA directory is huge, and I don't know where the actual executable is. My friend suggested I modify its run configuration through use of the argument tab, but like I said I don't actually know where the executable is. All I have is the large uncompressed jar file. How can I go about getting it set up in Eclipse?

解决方案

Two allow Eclipse to use JNA, all you need to do is to put two jar files in Eclipse's Java Build Path, jna.jar and platform.jar. That's it.

To do this for an individual project, right click on the project in the Package Explorer, click Properties (at the bottom), click Java Build Path on the left, then the Add External Jar files. Browse to the directory with your JNA files and add those two files.

这篇关于准备在Eclipse中使用JNA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆