Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

java.util.Arrays not defined?

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

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?

Share: 

 

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

java.util.Vector;

 
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[]
array={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
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
1.1,
in Your case java.util.Arrays doesn't exist in JDK 1.1 it only exist in JDK 1.2
above.
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
different
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
product.
and also u have to know that j++ is not java, it was a primitive c#, nothing
more,
has its own jvm build by ms and has no more support for next generation java
libraries.
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.




Tagged: