Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

java.util.Arrays not defined?

  Asked By: Darcy    Date: Mar 09    Category: Java    Views: 2696

I have just installed Visual J++ 6.0 and I tried to compile a JAVA file that

compiles well using Sun ONE Studio. Compiler says that java.util.Arrays

package is undefined. Why doesn't Visual J++ recognize the JDK installed in

my PC? does it install another one? How can I solve this problem?



6 Answers Found

Answer #1    Answered By: Aalia Arain     Answered On: Mar 09

You do not need to explicitly import array
You should create it like

int[] intArray = new int[size];

if you need vector
than it is in


Answer #2    Answered By: Terence Mitchell     Answered On: Mar 09

I'm using Arrays.fill method to initialize the array with zeros. I didn't find
an analogous function in Vector class and by creating my own function that
iterates for all elements and assign 0 to them it's not more optimal than the
JDK implemented functions, I think.

Answer #3    Answered By: Adalwin Fischer     Answered On: Mar 09

Maybe you should explicitly modify Visual J++ 6.0
Somewhere in the preferences or in options so that
It will use the jdk  you have installed.

Answer #4    Answered By: Skye Hughes     Answered On: Mar 09

This is the speedy one;

static int[]
System.arraycopy(array, 0, myarray, 0, 12);

: )

And this is the Arrays.fill implementation

public static void fill(int[] a, int fromIndex, int toIndex, int val) {
rangeCheck(a.length, fromIndex, toIndex);
for (int i=fromIndex; i<toIndex; i++)
a[i] = val;

Answer #5    Answered By: Funsani Chalthoum     Answered On: Mar 09

AFAIK, visual  J++ only use JDK 1.1, so that you can compile  code with JDK above
in Your case java.util.Arrays doesn't exist in JDK 1.1 it only exist in JDK 1.2
that the weakness of visual J++.

You should change your IDE, if you want to compile with latest JDK such as
eclipse or maybe NetBeans

"Don't take life too seriously, cause you never get out alive"

Answer #6    Answered By: Randall Franklin     Answered On: Mar 09

u have to forget j++. try eclipse or jdeveloper. j++ has nothing more to serve u
than jdeveloper or a powerfull eclipse instalation with some useable pluggins.
and also
thay are free and platform independent, can run every platform with a singe jre
installation. j++ has been depricated and ms will not give any support on this
and also u have to know that j++ is not java, it was a primitive c#, nothing
has its own jvm build by ms and has no more support for next generation java
util, swing ...

Didn't find what you were looking for? Find more on java.util.Arrays not defined? Or get search suggestion and latest updates.