[groovy-user] Groovyc generates a "java.lang.SecurityException" with Vista

44 views
Skip to first unread message

Fred Janon

unread,
Feb 4, 2008, 12:06:13 AM2/4/08
to Groovy User
I just installed Groovy 1.5.4 with the Windoz installer on Vista, opened a cmd window and typed "groovyc" as I used to with Groovy 1.0. I get a security exception. If I double click on "groovyc.bat" it works. Here is the error and my environment variable setting. Any idea of what's going on?

Thanks

Fred

C:\Users\Fred>groovyc
java.lang.SecurityException: Prohibited package name: java.lang
        at java.lang.ClassLoader.preDefineClass(ClassLoader.java:479)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:614)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:142)
        at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:114)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at org.codehaus.groovy.tools.RootLoader.oldFindClass(RootLoader.java:142)
        at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:114)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:91)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)

C:\Users\Fred>set
ALLUSERSPROFILE=C:\ProgramData
ANT_HOME=C:\ant-1.7.0
APPDATA=C:\Users\Fred\AppData\Roaming
CLASSPATH=.;C:\jdk1.6.0_02\jre\lib\rt.jar;C:\Program Files\Java\jre1.6.0_02\lib\ext\QTJava.zip
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=FRED-PC
ComSpec=C:\Windows\system32\cmd.exe
DERBY_HOME=C:\Program Files\Sun\JavaDB
DXSDK_DIR=C:\Program Files\Microsoft DirectX SDK (August 2007)\
FP_NO_HOST_CHECK=NO
GROOVY_HOME=C:\Groovy-1.5.4
HOMEDRIVE=C:
HOMEPATH=\Users\Fred
JAVA_HOME=C:\jdk1.6.0_02
LOCALAPPDATA=C:\Users\Fred\AppData\Local
LOGONSERVER=\\FRED-PC
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\jdk1.6.0_02\bin;c:\scala-2.6.0\bin;C:\Program Files\Microsoft DirectX SDK (August 2007)\Utilities\Bin\x86;C:\Win
dows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\ATI Technologies\ATI.ACE\
Core-Static;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\S
un\JavaDB\bin;C:\ant-1.7.0\bin;C:\Groovy-1.5.4\bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.groovy;.gy
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 11, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f0b
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
PROMPT=$P$G
PUBLIC=C:\Users\Public
QTJAVA=C:\Program Files\Java\jre1.6.0_02\lib\ext\QTJava.zip
SCALA=c:\scala-2.6.0
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\Fred\AppData\Local\Temp
TMP=C:\Users\Fred\AppData\Local\Temp
USERDOMAIN=Fred-PC
USERNAME=Fred
USERPROFILE=C:\Users\Fred
windir=C:\Windows

Fred Janon

unread,
Feb 4, 2008, 12:21:28 AM2/4/08
to Groovy User
A bit more info...

C:\GroovyTest>groovyc.bat -v
Groovy compiler version 1.5.4
Copyright 2003-2007 The Codehaus. http://groovy.codehaus.org/


C:\GroovyTest>groovyc -v

Jim White

unread,
Feb 4, 2008, 12:28:15 AM2/4/08
to us...@groovy.codehaus.org
Fred Janon wrote:

> I just installed Groovy 1.5.4 with the Windoz installer on Vista, opened
> a cmd window and typed "groovyc" as I used to with Groovy 1.0. I get a
> security exception. If I double click on "groovyc.bat" it works. Here is
> the error and my environment variable setting. Any idea of what's going on?
>
> Thanks
>
> Fred
>
> C:\Users\Fred>groovyc
> java.lang.SecurityException: Prohibited package name: java.lang

> ...


> C:\Users\Fred>set
> ALLUSERSPROFILE=C:\ProgramData
> ANT_HOME=C:\ant-1.7.0
> APPDATA=C:\Users\Fred\AppData\Roaming
> CLASSPATH=.;C:\jdk1.6.0_02\jre\lib\rt.jar;C:\Program
> Files\Java\jre1.6.0_02\lib\ext\QTJava.zip

> ...

It is illegal to have rt.jar on your CLASSPATH (it contains classes that
begin with "java.lang").

Jim


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Fred Janon

unread,
Feb 4, 2008, 12:45:49 AM2/4/08
to us...@groovy.codehaus.org
Thanks Jim. I removed rt.jar from the classpath and it works now.

Is it an issue for just for Groovy or any java program in general?

Cheers

Fred

Jim White

unread,
Feb 4, 2008, 1:42:21 AM2/4/08
to us...@groovy.codehaus.org
Fred Janon wrote:

> Thanks Jim. I removed rt.jar from the classpath and it works now.
>
> Is it an issue for just for Groovy or any java program in general?

Any Java. To define classes in the "java.lang" package you have to use
the -Xbootclasspath option of the java executable.

Jim White

unread,
Feb 4, 2008, 1:46:09 AM2/4/08
to us...@groovy.codehaus.org
Jim White wrote:

> Fred Janon wrote:
>
>> Thanks Jim. I removed rt.jar from the classpath and it works now.
>>
>> Is it an issue for just for Groovy or any java program in general?
>
>
> Any Java. To define classes in the "java.lang" package you have to use
> the -Xbootclasspath option of the java executable.

Actually I mean to say defining classes in any package beginning "java.".

Reply all
Reply to author
Forward
0 new messages