Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import javax.vecmath

I would like to use javax.vecmath in my Java program but unfortunately it says:

The import javax.vecmath cannot be resolved

Should I add the jar by myself in the project? Where can I find that jar file? I'm on Ubuntu/Eclipse Galileo.

like image 982
user319869 Avatar asked Dec 07 '10 20:12

user319869


4 Answers

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.

like image 137
Laurence Gonsalves Avatar answered Sep 23 '22 01:09

Laurence Gonsalves


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:

<dependency>
    <groupId>javax.vecmath</groupId>
    <artifactId>vecmath</artifactId>
    <version>1.5.2</version>
</dependency>

See the latest version of the package on Maven Central.


As the top-voted answer suggests, you can get the jar in Ubuntu with:

apt-get install libvecmath-java

And then you can find the location of the jar file with:

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.

To add a jar to the build path in Eclipse (in a non-Maven project):

  1. Right-click on the project
  2. Select Build Path / Add External Archives...
  3. Browse to the jar file and select it

In other operating systems you can download the jar file directly from Maven Central:

https://mvnrepository.com/artifact/javax.vecmath/vecmath/

like image 31
janos Avatar answered Sep 24 '22 01:09

janos


Search for the vecmath file, you may find it in /usr/share/java.

Copy the contents of this folder to /jdk_installation_folder/jre/lib/ext.

For me, it is /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.

$ 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.

apt-get install libvecmath-java
like image 40
user3786745 Avatar answered Sep 22 '22 01:09

user3786745


Suggestion#1:

libvecmath-java software 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,

$ sudo apt-get update
$ sudo apt-get install libvecmath-java 

libvecmath-java is installed in your system.

Make ensure the libvecmath-java package were installed using the commands given below,

$ sudo dpkg-query -l | grep libvecmath-java *

You will get with libvecmath-java package name, version, architecture and description in a table.

Resource Link: http://thelinuxfaq.com/ubuntu/ubuntu-17-04-zesty-zapus/libvecmath-java

Suggestion#2:

Open a terminal and install the Java 3D API. This api is also includes vecmath.jar.

sudo apt-get install libjava3d-java

Resource Link:

  1. https://askubuntu.com/a/626128
  2. https://www.howtoinstall.co/en/ubuntu/xenial/libjava3d-java

Suggestion#3:

You can also download the zip, binary or exe from the following oracle link:

  1. http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-java-client-419417.html#java3d-1.5.1-oth-JPR

Suggestion#4:

In eclipse, step by step installation procedure with pictures, is given in the following link:

  1. https://www.cs.utexas.edu/~scottm/cs324e/handouts/setUpJava3dEclipse.htm
like image 41
SkyWalker Avatar answered Sep 24 '22 01:09

SkyWalker