Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: SecurityManager exception

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up SecurityManager exception

    import java.lang.*;
    public class java17_test extends SecurityManager{
     
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
     
     
    		System.setSecurityManager(new securityHouse());
    		System.exit(1);
     
    	}
     
    }
     
     
    class securityHouse extends SecurityManager{
    	public void house(){
    		 checkExit(1);
     
    		}
    	}

    I expected to get a SecurityException as soona as I invoked the System.exit(1) method but I failed to get one..
    Is my logic right?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: SecurityManager exception

    What does the house() method do? Who calls it?

  3. #3
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: SecurityManager exception

    You need to have a security configuration file with this as well or override some methods on the SecurityManager that check to see if you're allowed to call System.exit(int);

    // Json

Similar Threads

  1. Exception during xml validation
    By vijeta in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 6th, 2010, 02:50 AM
  2. Exception consuming WebService
    By lzorratto in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: February 23rd, 2010, 09:13 AM
  3. Exception Errors
    By TIMBERings in forum Exceptions
    Replies: 1
    Last Post: December 10th, 2009, 02:13 AM
  4. Error of "ClassNotFound Exception"
    By multicoder in forum Exceptions
    Replies: 3
    Last Post: July 1st, 2009, 02:58 PM
  5. Exception handling
    By AnithaBabu1 in forum Exceptions
    Replies: 6
    Last Post: August 27th, 2008, 09:37 AM

Tags for this Thread