Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jason Perry   on Jun 23 In Java Category.

  
Question Answered By: Anuja Shah   on Jun 23

I ran this test class  with JDK1.4_02

import java.security.CodeSource;
import java.security.ProtectionDomain;

public class TestLocation
{

public TestLocation(){
System.out.println("This is the sample constructor");
}

public static void main(String args[]){
try{
System.out.println("Code ----Location---" +
Class.forName("TestLocation").getProtectionDomain().getCodeSource().getLocation(\
));
}catch(ClassNotFoundException e){
System.out.println("---The exception " + e);
}
}
}

and the output was

Code ----Location---file:/D:/JDev905/jdev/mywork/Test/Java/classes/

Share: 

 
 
Didn't find what you were looking for? Find more on Source dir Or get search suggestion and latest updates.


Tagged: