【Java开源代码栏目提醒】:网学会员,鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“CheckPermissions.java”一文,供大家参考学习!
package ejava.jsecuritych27;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.security.AccessControlException;
public class CheckPermissions
{
public static void main(String[] args)
{
// check whether the application has permission to read
// properties.
String operatingSystem = (String)System.getProperty("os.name");
String javaVersion = (String)System.getProperty("java.version");
try{
String javaDirectory = (String)System.getProperty("java.home");
String userHomeDir = (String)System.getProperty("user.home");
String myFile = (String)System.getProperty("myFile");
FileInputStream fin = new FileInputStream(myFile);
}
catch(FileNotFoundException fne){
System.out.println("File not found Exception "+fne);
System.exit(0);
}
catch(AccessControlException ace){
System.out.println("Security Access Control Exception "+ace);
System.exit(0);
}
}
}
上一篇:
CheckOverlap.java
下一篇:
一个人晕着也能去看病打针