aspose file tools
The moose likes Java in General and the fly likes SecurityException: Prohibited package name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "SecurityException: Prohibited package name" Watch "SecurityException: Prohibited package name" New topic

SecurityException: Prohibited package name

Prasma Kankut

Joined: Oct 15, 2003
Posts: 21
Is there anything wrong with the following method? It is throwing java.lang.SecurityException: Prohibited package name: java.lang.

Here is the full stack trace.

Exception in thread "main" java.lang.SecurityException: Prohibited package name: java.lang
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$100(Unknown Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)


<i>The fact that today we know more than yesterday is good news about today, not bad news about yesterday - Ilja Preuss</i>
Joe Ess

Joined: Oct 29, 2001
Posts: 9069

I don't suppose you have a package statement at the beginning of your java file?

[How To Ask Questions On JavaRanch]
Prasma Kankut

Joined: Oct 15, 2003
Posts: 21
No. There is no package statement.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24189

It's possible to get this kind of error if you're using an old JDK that doesn't include some newer API class, but then you put a newer JDK's rt.jar (which does include that class) on the CLASSPATH. The old JDK will become very unhappy upon loading a java.lang.Something class from the CLASSPATH instead of from the boot class loader. Check to see if your CLASSPATH includes any rt.jar's -- it's never appropriate to include them.
Although I think this can only happen when there's a SecurityManager present: JaveWebStart, Applets, RMI, etc.

[Jess in Action][AskingGoodQuestions]
Prasma Kankut

Joined: Oct 15, 2003
Posts: 21
Thanks Ernest, you got it right! Looks like it was the Oracle client which did the mischief.
But I can't get your point about the SecurityManager. Do you say this error will occur only when using Applets, RMI etc? But mine is a simple Java application.
Also, I noted another thing - this error occurs only when I use the java.util.regex package. Else everything is fine.
Does it mean that, the old JDK don't have this package and hence the error?
wood burning stoves
subject: SecurityException: Prohibited package name