1

I'm transitioning a Java project from Eclipse on Windows to Eclipse on Ubuntu. I have installed the Jama library and found that Ubuntu placed it in /usr/share/java . Now I am trying to make Eclipse find it there. I have read various posts on this subject (on Stackoverflow and elsewhere) and have tried the following:

  1. added the line -Djava.library.path=/usr/share/java/ to the file /etc/eclipse.ini

  2. added the directory /usr/share/java through the project Properties > Build Path > Libraries > Native library location

Neither of these worked. Please note that I want to add /usr/share/java just once and not have to add it to every project or import the .jars to each project. (I'm not sure if the 2nd approach, had it worked, would have affected ALL projects or just the current one.) Also there are a lot of .jar files in the /usr/share/java directory, so I was hoping that one configuration change would handle them all.

As a secondary question from a Java newbie, I'm a little confused about the capitalization used in import statements. All the Jama examples show import Jama.*; and the uppercase "Jama" worked on Windows, but I'm confused by the fact that the file is named jama.jar . How does the compiler know to look for a lower case file name? (I tried both cases, but the library is just not being found.)

Jorocco
  • 83
  • 2
  • 9
  • 1
    "Neither of these worked." *What* *happens* *instead*? – nitind Sep 17 '13 at 21:31
  • The "import Jama.*;" statement results in a compiler error due to the Jama library not being found. – Jorocco Sep 19 '13 at 02:40
  • Where in /usr/share/java did it put it? Not that anyone's asking, but that was probably a *bad* thing for it to do. Now *everything* *you* *run* has Jama libraries in its classpath. – nitind Sep 19 '13 at 14:54

1 Answers1

0

Right click your project go to -> Properties -> Java Build Path then click the Libraries tab, then click the "Add Library..." button.

Hope this helps

javaNinja
  • 521
  • 1
  • 5
  • 13
  • I'm not sure which of the four choices you're suggesting after "Add Library" (JRE System Library, JUnit, Plug-in Dependencies, or User Library), but this approach looks to me like this would only address the CURRENT project, not ALL projects in Eclipse. When I was trying to edit the system /etc/eclipse.ini, I was hoping to make a system-wide change affecting all users and all projects on the Ubuntu system. – Jorocco Sep 17 '13 at 22:31
  • "User Library" is the choice I would select. Yes, this will only effect the current project. – javaNinja Sep 19 '13 at 17:15