0

When I try to run an applet I get the Exception:

java.lang.reflect.InvocationTargetException

I read that the invocation error would be due to access modifiers:
http://download.oracle.com/javase/tutorial/reflect/member/ctorTrouble.html

and further down in the stack trace I read:

Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: 
Class sun.plugin2.applet.Plugin2Manager$12 can not access 
a member of class gui.TestWindow with modifiers ""

I didn't think I had any problems with access modifiers, so just out of curiosity I put the public modifier on all fields and methods in that class, but the problem persists. I do also have a constructor with 0 arguments that is public, so it can't be that.

sll
  • 61,540
  • 22
  • 104
  • 156
Dude Dawg
  • 1,465
  • 2
  • 15
  • 26
  • 2
    You haven't shown us *any* of your code, or at what point you're getting the problem. Please give us some code... – Jon Skeet Aug 13 '11 at 13:59
  • My code works just fine when I'm running it normally, not as an applet. The error message in error console is cut of after several lines, non of the lines in the error consoles point to my code. – Dude Dawg Aug 13 '11 at 14:02
  • So you're trying to run an application as an applet? (You should still show us your code.) – Jeffrey Aug 13 '11 at 14:08
  • It is of course an applet that I'm trying to run. – Dude Dawg Aug 13 '11 at 14:36
  • showing the code could help - you should really consider this. Are you sure the class is public and not package-private? – fdreger Aug 13 '11 at 14:54

2 Answers2

2
class MyApplet ...

Will cause an InvocationTargetException, whereas..

public class MyApplet ...

..should be fine.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
0

Make your applet class Public that should do it. That's it