导入 javax.vecmath
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4381291/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Import javax.vecmath
提问by user319869
I would like to use javax.vecmath
in my Java program but unfortunately it says:
我想javax.vecmath
在我的 Java 程序中使用,但不幸的是它说:
The import javax.vecmath cannot be resolved
导入 javax.vecmath 无法解析
Should I add the jar by myself in the project? Where can I find that jar file? I'm on Ubuntu/Eclipse Galileo.
我应该在项目中自己添加 jar 吗?我在哪里可以找到那个 jar 文件?我在 Ubuntu/Eclipse Galileo 上。
回答by Bozho
回答by Laurence Gonsalves
On Ubuntu you can apt-get install libvecmath-java
. On other systems do what Petar Minchev suggests, or search on Google for something like "java vecmath", which turns up https://vecmath.dev.java.net/, and then go to their downloads page.
在 Ubuntu 上你可以apt-get install libvecmath-java
。在其他系统上,按照 Petar Minchev 的建议进行操作,或者在 Google 上搜索“java vecmath”之类的内容,该内容会出现https://vecmath.dev.java.net/,然后转到他们的下载页面。
回答by user3786745
Search for the vecmath
file, you may find it in /usr/share/java
.
搜索该vecmath
文件,您可能会在/usr/share/java
.
Copy the contents of this folder to /jdk_installation_folder/jre/lib/ext
.
将此文件夹的内容复制到/jdk_installation_folder/jre/lib/ext
.
For me, it is /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
.
对我来说,是/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
。
To copy you can use either the cp
-command or change the ext
folder permission to 777
using chmod
.
要复制,您可以使用 -cp
命令或将ext
文件夹权限更改为777
using chmod
。
$ chmod 777 /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
Then copy all the files in file explorer.
然后复制文件资源管理器中的所有文件。
$ chmod 755 /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
If you do did not find the vecmath.jar
file, then download and install it.
如果您没有找到该vecmath.jar
文件,请下载并安装它。
apt-get install libvecmath-java
回答by Vivek Vermani
This package is part of Java3D.
这个包是 Java3D 的一部分。
回答by janos
Instead of trying to obtain the file through some OS-dependent package,
it would be better to use a dependency manager, for example Maven or Gradle.
Using Maven, you could add this dependency to the pom.xml
file of your project:
与其尝试通过某些依赖于操作系统的包获取文件,不如使用依赖管理器,例如 Maven 或 Gradle。使用 Maven,您可以将此依赖项添加到pom.xml
您的项目文件中:
<dependency>
<groupId>javax.vecmath</groupId>
<artifactId>vecmath</artifactId>
<version>1.5.2</version>
</dependency>
See the latest version of the package on Maven Central.
在Maven Central上查看包的最新版本。
As the top-voted answer suggests, you can get the jar in Ubuntu with:
正如最高投票的答案所暗示的那样,您可以通过以下方式在 Ubuntu 中获取 jar:
apt-get install libvecmath-java
And then you can find the location of the jar file with:
然后你可以找到jar文件的位置:
dpkg -L libvecmath-java | grep jar$
Which should output something like:
应该输出如下内容:
/usr/share/java/vecmath-1.5.2.jar
/usr/share/java/vecmath.jar
It's really just one jar, the file without version is a symbolic link to the other.
它实际上只是一个 jar,没有版本的文件是另一个的符号链接。
To add a jar to the build path in Eclipse (in a non-Maven project):
将 jar 添加到 Eclipse 中的构建路径(在非 Maven 项目中):
- Right-click on the project
- Select Build Path / Add External Archives...
- Browse to the jar file and select it
- 右键单击项目
- 选择构建路径/添加外部档案...
- 浏览到 jar 文件并选择它
In other operating systems you can download the jar file directly from Maven Central:
在其他操作系统中,您可以直接从 Maven Central 下载 jar 文件:
回答by SkyWalker
Suggestion#1:
建议#1:
libvecmath-javasoftware package provides javax.vecmath vector math package, you can install in your Ubuntu 17.04 (Zesty Zapus)
by running the commands given below on the terminal,
libvecmath-java软件包提供了 javax.vecmath 向量数学包,您可以Ubuntu 17.04 (Zesty Zapus)
通过在终端上运行下面给出的命令来安装,
$ sudo apt-get update
$ sudo apt-get install libvecmath-java
libvecmath-java is installed in your system.
libvecmath-java 已安装在您的系统中。
Make ensure the libvecmath-java package were installed using the commands given below,
确保使用下面给出的命令安装了 libvecmath-java 包,
$ sudo dpkg-query -l | grep libvecmath-java *
You will get with libvecmath-java package name, version, architecture and description in a table.
您将在表格中获得 libvecmath-java 包名称、版本、架构和描述。
Resource Link:http://thelinuxfaq.com/ubuntu/ubuntu-17-04-zesty-zapus/libvecmath-java
资源链接:http : //thelinuxfaq.com/ubuntu/ubuntu-17-04-zesty-zapus/libvecmath-java
Suggestion#2:
建议#2:
Open a terminal and install the Java 3D API. This api is also includes vecmath.jar.
打开终端并安装 Java 3D API。这个 api 还包括 vecmath.jar。
sudo apt-get install libjava3d-java
Resource Link:
资源链接:
Suggestion#3:
建议#3:
You can also download the zip, binary or exe from the following oracle link:
您还可以从以下 oracle 链接下载 zip、二进制文件或 exe:
Suggestion#4:
建议#4:
In eclipse, step by step installation procedure with pictures, is given in the following link:
在eclipse中,有图片的分步安装过程,在以下链接中给出:
回答by kjanderson2
If you are having this issue in an Android project in Android Studio, I had a similar problem and added the following to my dependencies inside of app/build.gradle
如果您在 Android Studio 的 Android 项目中遇到此问题,我遇到了类似的问题,并将以下内容添加到 app/build.gradle 中的依赖项中
implementation 'javax.vecmath:vecmath:1.5.2'