I've tried installing the jackcess libaray (http://sourceforge.net/projects/jackcess/files/) into my project using Project/Preferences/install jar. However, when I try

import static com.healthmarketscience.jackcess.Database.*;

it just says 'Incorrect package'.

How do you install this type of libarary? (I'm a real nooob so sorry if this is obvious).

Also - why so many programmers so against using Access databases. I've used Access a fair bit at work and like the idea of being able to manipulate the data with MS Access. I can't see the downside?

3 Years
Discussion Span
Last Post by JamesCherrill

import static imports any static final variables from a class (eg Colors from the Color class).
Youu probably should be using just
import com.healthmarketscience.jackcess.Database.*;
to import the classes.


James are you sure that it is for final static. Because as per my view it is not necessary to be a final(static variables are like instance variables, if you don't initialize explicitly, they will get default value, but for the final you have to explicitly initialize them with a value!),only static variables.I think so you are referring to emuns(enums are implicitly final).

@James :- It might be a little confusion on either side.

In order to access static members, it is necessary to qualify references with the class they came from. For example, one must say:
double r = Math.cos(Math.PI * theta);
The static import construct allows unqualified access to static members without inheriting from the type containing the static members. Instead, the program imports the members, either individually:

import static java.lang.Math.PI;


The 'static' seems to have been the problem. I copied it from an example so that's a lesson.

Thanks for your help!


Please mark this "solved" for out knowledge base.

ps IIM: Yes, you're right. My mistake. I've never used, or seen used, import static for anything other than constants (public static final), so i jumped to an incorrect conclusion. Thanks for clearing that up. J

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.