Read a property from local system
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Tuesday, March 13, 2007 08:09 AM

Database Monitoring Tool! Hi , Iam very much new to applets. As of now i just want to print string returned from System.getProperty("java.library.path") Iam not even sure whether iam following the correct steps to make a signed applet. I added the permission to java.plocy file as permission java.util.PropertyPermission "java.library.path", "read"; so here iam writing the steps, let me know if iam wrong anywhere. 1. javac ReadFile.java 2. jar cvf ReadFile.jar ReadFile.jar 3. keytool -genkey -alias read2 4. keytool -selfcert    More>>
Database Monitoring Tool!

Hi ,


Iam very much new to applets.


As of now i just want to print string returned from System.getProperty("java.library.path")


Iam not even sure whether iam following the correct steps to make a signed applet.


I added the permission to java.plocy file as


permission java.util.PropertyPermission "java.library.path", "read";


so here iam writing the steps, let me know if iam wrong anywhere.


1. javac ReadFile.java


2. jar cvf ReadFile.jar ReadFile.jar


3. keytool -genkey -alias read2


4. keytool -selfcert -alias read2


5. appletviewer index.html


ReadFile.java


import java.awt.*;

import java.awt.event.*;

import java.applet.*;

import java.applet.Applet;


import java.util.*;

import java.io.*;

import java.net.*;



public class ReadFile extends Applet
{

private Button welcomeButton;


private String webServerStr = null;


private String hostName = "10.15.42.57";


private int port = 8080;


private String servletPath = "/TCS/ReadFileservlet";


public void init()
{




}


public void paint(Graphics g)
{

String filepath="";

try{

filepath=getFilePath();

}

catch(Exception e){

System.out.println(e.getMessage());

}

g.setColor(Color.black);

g.drawString(filepath, 60, 50);



}

public static String getFilePath() throws Exception
{

//File dir = new File(System.getProperty("java.library.path"));

//File dir = new File("");

String filepath=System.getProperty("java.library.path");

return filepath;

//StringTokenizer st = new StringTokenizer(dir.toString(),";");

}
}



index.html






















Thanks in advance,
Mallesh

   <<Less
About | Sitemap | Contact