This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Error when not in Main() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error when not in Main()" Watch "Error when not in Main()" New topic
Author

Error when not in Main()

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I have the following Code:

When I run this code I get the following error
Exception occurrred during event dispatching:
java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
If I have the same code in a main() it works fine. Anytime I take that code and put it in init() or another method other than main() this is the error I get.
Does anyone know why?
Thanks


GenRocket - Experts at Building Test Data
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

This might help:
http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=3&t=001110
if you do a search on this forum using 'applet security' you'll find more.
Jamie
[ January 11, 2002: Message edited by: Jamie Robertson ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks Jamie. That got it.
 
jQuery in Action, 2nd edition
 
subject: Error when not in Main()
 
Similar Threads
ClassNotFoundException generated!
SQLException: [Microsoft][ODBC Driver Manager]
No Suitible Driver Error
Access to the Oracle database using Java Applets
Error in connection