Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why I can not find Arrays.asList(Object [] s)

2,086 views
Skip to first unread message

abc_abc

unread,
Mar 12, 2001, 10:16:05 PM3/12/01
to
In Jdk1.3,when I use Arrays.asList. The complier will complain:

Unsupported.java:11: cannot resolve symbol
symbol : method asList (java.lang.String[])
location: class Arrays
static List a = Arrays.asList(s);

But I import java.util.*;

Why?
Thanks

Jon Skeet

unread,
Mar 13, 2001, 3:24:42 AM3/13/01
to

Could you show us your whole program?

import java.util.*;

class Test
{
public static void main (String [] args)
{
List list = Arrays.asList (args);
}
}

works fine.

--
Jon Skeet - sk...@pobox.com
http://www.pobox.com/~skeet

Nils O. Selåsdal

unread,
Mar 13, 2001, 9:01:24 AM3/13/01
to

"Jon Skeet" <sk...@pobox.com> wrote in message
news:MPG.1517e9a82...@10.1.1.51...

> abc_abc <%5fabcNO%5S...@sun.partner.remarq.com.invalid> wrote:
> > In Jdk1.3,when I use Arrays.asList. The complier will complain:
> >
> > Unsupported.java:11: cannot resolve symbol
> > symbol : method asList (java.lang.String[])
> > location: class Arrays
> > static List a = Arrays.asList(s);
> >
> > But I import java.util.*;
>
> Could you show us your whole program?
>
> import java.util.*;
>
> class Test
> {
> public static void main (String [] args)
> {
> List list = Arrays.asList (args);
> }
> }
>
And if it still doesnt work, there is probably some old javac or java
lurking around
in your PATH.(or a CLASSPATH?)
check with
java -version

Jim Korman

unread,
Mar 13, 2001, 7:48:02 PM3/13/01
to
I tried the following and it works fine

String [] s =
{
"ah",
"bg",
"cf",
"de",
};

List x = Arrays.asList(s);

In your code is your argument 's' an array?

abc_abc

unread,
Mar 16, 2001, 6:33:09 PM3/16/01
to

I tried your Test.java. The message is below.
javac Test.java
Test.java:6: cannot resolve symbol


symbol : method asList (java.lang.String[])
location: class Arrays

List list = Arrays.asList (args);

^
1 error

java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

What is the problem?

Thanks.

Jon Skeet

unread,
Mar 17, 2001, 8:17:15 AM3/17/01
to
abc_abc <%5fabcNO%5S...@sun.partner.remarq.com.invalid> wrote:

> java -version
> java version "1.3.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
> Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
>
> What is the problem?

Looks like your javac installation is rather odd. Do you perhaps have a
1.1 javac somewhere in your path?

Try c:\jdk1.3\bin\javac Test.java

abc_abc

unread,
Mar 18, 2001, 5:07:11 PM3/18/01
to
thank you very much!!
I find it out!
I made a mistake.
I ever put a Arrays.java file in the local directory!
A so .... mistake.


0 new messages