• Post Reply Bookmark Topic Watch Topic
  • New Topic

Illegal Access Exception  RSS feed

 
Greenhorn
Posts: 7
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When does this illegal access exception arise? I don't face it when i use NETBEANS IDE but when i upload the solution it doesnot support test parameters and the error is illegal access exception..



can you please explain why in general this illegal access exception is encountered? and do i have a way to find out which part of the code might have caused the exception. i mean is there a way to catch the illegal access exception.
The online API has some vague information but i absolutely have no idea as to what it means..
Illegal access exception java API
 
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is not enough information here. Post the entire error message. Try to write as small a program (or at least a class) as will produce the error. You have told us what the error is in general but not your specific output of it, and the code you've listed would not produce the error by itself (even if it were in a complete class).
 
Greenhorn
Posts: 12
Chrome Eclipse IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harsha
Yes, Ralph is right. You need to give some more information about your problem. It will help us to identify the problem and assist you.
 
Bartender
Posts: 4002
42
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Sree Harsha Subraveti!
The online API has some vague information but i absolutely have no idea as to what it means..

It says if your code tries to create an instance/access any field through Java reflection which the caller does not have access to the particular class/field it may result this exception.

Can you explain/show your code which throws the exception and the any related code it uses.
 
sree harsha subraveti
Greenhorn
Posts: 7
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey actually it's my solution to topcoder. I just couldnot understand where this illegal access exception is occuring.. it's a bit of clumsy code. This works well on Netbeans 7.0 IDE


can you tell me where this multiple instances thingy happens..
 
Vijitha Kumara
Bartender
Posts: 4002
42
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but when i upload the solution it doesnot support test parameters and the error is illegal access exception..

My initial thought was something wrong with the program. But it looks like the site/simulator you are using has some issues with your code. Perhaps it expects some test method to be present to execute? Have you checked what is expected by that?
 
sree harsha subraveti
Greenhorn
Posts: 7
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the code works fine. The simulator shows me to keep dat pointVal method public. and i did it. yet the test parameters are not accepted.

i should have emphasized that the code works fine.
I am just confused if any field or parameters have caused the illeagalaccessexception. infact, the code compiles successfully..
 
sree harsha subraveti
Greenhorn
Posts: 7
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my case, i could resolve the problem by declaring the class public. Thanks for the help.

if class is not declared public, it is package-private apparently..
 
Vijitha Kumara
Bartender
Posts: 4002
42
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if class is not declared public, it is package-private apparently..

Yes, it is.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!