You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Mohamed Nufail <nu...@gmail.com> on 2012/04/05 09:10:52 UTC

Running junit tests with Intellij Idea

Hi,

I am trying to run the junit tests using Intellij Idea, but I keep getting
errors. For example with the
org.apache.derbyTesting.unitTests.junit.DerbyVersionTest I keep getting the
following exception.

Exception in thread "main" java.security.AccessControlException: access
denied (java.lang.RuntimePermission setIO)
    at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
    at
java.security.AccessController.checkPermission(AccessController.java:546)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at java.lang.System.checkIO(System.java:225)
    at java.lang.System.setOut(System.java:147)
    at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:189)
    at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)


The classpath does include junit.jar and the classes folder.

I can run the tests without any problem in command line and using eclipse
as described in [1].

[1] http://wiki.apache.org/db-derby/DerbyJUnitTesting


-- 

Mohamed Nufail
Undergraduate,
Department of Computer Science & Engineering,
University of Moratuwa.
Blog: http://www.nufailm.blogspot.com/

Re: Running junit tests with Intellij Idea

Posted by Rick Hillegas <ri...@oracle.com>.
Hi Mohamed,

I don't have any experience using Intellij. However, the stack trace 
indicates that Intellij is trying to change the location of System.out 
after the security manager has been installed. 
java.lang.RuntimePermission setIO) needs to be granted to the Intellij 
jar file.

Hope this is helpful,
-Rick

On 4/5/12 12:10 AM, Mohamed Nufail wrote:
> Hi,
>
> I am trying to run the junit tests using Intellij Idea, but I keep 
> getting errors. For example with the 
> org.apache.derbyTesting.unitTests.junit.DerbyVersionTest I keep 
> getting the following exception.
>
> Exception in thread "main" java.security.AccessControlException: 
> access denied (java.lang.RuntimePermission setIO)
>     at 
> java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
>     at 
> java.security.AccessController.checkPermission(AccessController.java:546)
>     at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
>     at java.lang.System.checkIO(System.java:225)
>     at java.lang.System.setOut(System.java:147)
>     at 
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:189)
>     at 
> com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at 
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
>
>
> The classpath does include junit.jar and the classes folder.
>
> I can run the tests without any problem in command line and using 
> eclipse as described in [1].
>
> [1] http://wiki.apache.org/db-derby/DerbyJUnitTesting
>
>
> -- 
>
> Mohamed Nufail
> Undergraduate,
> Department of Computer Science & Engineering,
> University of Moratuwa.
> Blog: http://www.nufailm.blogspot.com/
>