本文介绍了如何在netbeans中导入包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NetBeans IDE中的CloudSim项目,我需要将

 org.apache.common 

导入到我的项目中。



我已按照在我的Windows 10上安装Java jdk和NetBeans。然后我按照以下步骤将CloudSim项目添加到NetBeans:

1. file - >新项目 - > Java与Ant - >带有现有源的Java项目

2.为项目定义名称和文件夹,路径为:`\ CloudSim_Tutorial`

3.添加现有源我添加了CloudSim文件夹as我的来源

4.完成



该项目抛出错误:

包org.apache.common.math3.linear不存在





对于某些java文件。所以我在网上搜索并做了以下事情:

1.下载commons-math3-3.2-bin二进制文件

2.解压缩我项目文件夹中的zip文件, `\ CloudSim_Tutorial`

3.右键点击项目名称 - >属性

4.从弹出窗口中选择的库

5.在`classPath`中单击`+`符号

6.选中`commons-math3-3.2.jar`文件 - >好的



仍然会抛出错误。



导致错误的代码:

  import  org.apache.commons.math3.linear.Array2DRowRealMatrix; 





错误:

包org.apache.commons.math3.linear不存在。





我尝试了什么:



我看过很多教程但是我无法成功。

解决方案

I'm working on CloudSim project in NetBeans IDE and I need to import

org.apache.common

into my project.

I have followed youtube to install Java jdk and NetBeans on my windows 10. Then I followed steps below to add CloudSim project to NetBeans:
1. file -> new project -> Java with Ant -> Java Project with Existing Source
2. defined name and folder for project, the path is: `\CloudSim_Tutorial`
3. to add existing source I added CloudSim folder as my source
4. finish

The project throw an error that:

Package org.apache.common.math3.linear does not exist



for some java files. So I searched on the web and did the following:
1. download commons-math3-3.2-bin binary file
2. extracted the zip file in my project folder, `\CloudSim_Tutorial`
3. right click on project name -> properties
4. selected Libraries from pop-up window
5. in `classPath` clicked on `+` sign
6. selected the `commons-math3-3.2.jar` file -> Ok

It still throw the error.

The code causing error:

import org.apache.commons.math3.linear.Array2DRowRealMatrix;



Error:

Package org.apache.commons.math3.linear does not exist.



What I have tried:

I have see many tutorials but I couldn't make it.

解决方案


这篇关于如何在netbeans中导入包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 17:35