• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cloneable  RSS feed

 
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Exception in thread "main" java.lang.IllegalAccessError: tried to access method java.lang.Object.clone()Ljava/lang/Object; from class Test
at Test.main(Test.java:15)

I don't understand above error
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its protected access specifier !! thanks
 
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works for me.
What version of Java are you using?
Have you tried deleting the class files and recompiling everything?
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony Docherty wrote:It works for me.
What version of Java are you using?
Have you tried deleting the class files and recompiling everything?


No, its not working for me java version is 1.7.0_17
 
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
meeta gaur wrote:No, its not working for me java version is 1.7.0_17

Well, it works fine for me too.

I removed my first reply because it was plainly wrong; and I don't want to mislead anyone. You are tempting fate by defining A as Cloneable, but not including a clone() method though.

Winston
 
Tony Docherty
Bartender
Posts: 3271
82
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I put all the code in one java file called Test.java.
Compiled it in Eclipse using Java(TM) SE Runtime Environment (build 1.7.0_07-b11) set to build classes that are compatible with Java 1.6.
And ran it in Eclipse and it works.
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you winston and tony i will try to find out about that error.
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it JVM bug ?

Comment By: Daniel Bonniot (bonniot)
Date: 2004-03-24 12:18

Message:
Logged In: YES
user_id=88952

Thanks for the report. I tried the exact same version of the
Nice compiler on Linux, with both Java version 1.4.1 from
blackdown and 1.4.2 from Sun without any problem. Besides,

Exception in thread "main" java.lang.IllegalAccessError:
mlsub.typing.
lowlevel.BitMatrix tried to access method
java/lang/Object.clone()
Ljava/lang/Object;
at
mlsub.typing.lowlevel.BitMatrix.clone(BitMatrix.java:327)

seems strange, since BitMatrix is a subclass of Object, so
calling the protected method clone() is perfectly legal.
This makes me suspect that you are experimenting a JVM bug.
Could you try another version of the JVM or another machine?
Another option to workaround this bug would be to add the
"-noverify" option to the java command. It is not documented
in 'java -help', although it is recognized, so I'm not sure
if it has any effect.

source
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!