简体   繁体   English

将Jama库集成到Netbeans平台中

[英]Integrate Jama library in Netbeans platform

I would like to integrate the Jama library into Netbeans (not just a single project). 我想将Jama库集成到Netbeans中(不仅仅是一个项目)。 However, I get the message " package Jama does not exist. " I have done the following: 但是,我收到消息“ package Jama does not exist. ”我已经执行了以下操作:

  • I downloaded Jama's jar file. 我下载了Jama的jar文件。
  • Then I went to Tools , Libraries , pressed the button new library . 然后我进入“ ToolsLibraries ,按下“ new library ”按钮。
  • Put in the name of the library and hit OK . 输入库的名称,然后单击“ OK
  • Then I hit the button " Add JAR / Folder " and chose the jar file. 然后我点击“ Add JAR / Folder ”按钮,然后选择jar文件。

What can this be? 这会是什么? Unfortunately I only found descriptions of how to integrate libraries into individual projects. 不幸的是,我仅找到有关如何将库集成到单个项目中的描述。

You use the word "platform", so I'm assuming you are building an application based on the NetBeans Platform . 您使用“平台”一词,所以我假设您正在基于NetBeans Platform构建应用程序。

Whenever you want to use an external library in such an application it is generally (although not always, but it is the cleanest method) required to create a library wrapper module for your external jar. 每当您想在此类应用程序中使用外部库时,通常都需要为外部jar创建库包装器模块 (尽管并非总是如此,但这是最干净的方法)。 You essentially wrap that external jar in a NetBeans module. 您实际上是将该外部jar包装在NetBeans模块中。 Then you include the newly created module in application. 然后,将新创建的模块包含在应用程序中。

Creating a library wrapper module is simple, but the method depends if you are using Ant or Maven: 创建库包装器模块很简单,但是该方法取决于您使用的是Ant还是Maven:

  • Ant : New project --> NetBeans Modules --> Library Wrapper Module Ant :新项目-> NetBeans模块->库包装模块

在此处输入图片说明

  • Maven : Create an empty NetBeans module. Maven :创建一个空的NetBeans模块。 Add your Jama library as a dependency, something like: 将Jama库添加为依赖项,例如:
<dependency>
    <groupId>gov.nist.math</groupId>
    <artifactId>jama</artifactId>
    <version>1.0.3</version>
</dependency>

You also need to tell which packages your newly created module exposes to the rest of the world, but in your case it is likely to be everything, ie all packages in the jar. 您还需要告诉您新创建的模块向世界其他地方公开了哪些包,但是对于您而言,这很可能就是所有内容,即jar中的所有包。

Once you have wrapped your jar in a module then that functionality can be used from any other NetBeans Module as long as you create a dependency on your newly created module. 将jar封装在模块中之后,只要您对新创建的模块创建依赖关系,就可以从任何其他NetBeans模块使用该功能。

Note: If only one module in your application will actually directly interact with Jama (ie use its classes), then you do not need a library wrapper module. 注意:如果应用程序中只有一个模块实际上可以直接与Jama进行交互(即使用其类),则您不需要库包装模块。 Then you just do as follows on the module that will use the Jama classes: Right-click the top node of the project: 然后,您将在使用Jama类的模块上执行以下操作:右键单击项目的顶部节点:

在此处输入图片说明

Then choose "Properties" --> "Libraries" --> "Wrapped JARs" tab. 然后选择“属性”->“库”->“包装的JAR”选项卡。 And add your Jama jar there. 并在其中添加您的Jama罐子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM