473,626 Members | 3,320 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A question about java.policy.

dmjpro
2,476 Top Contributor
I want to permit the java application only to read any local file but i don't want any application to update a local file.
Is this related to java.policy?
Please suggest ....!
Jul 25 '08 #1
15 2178
r035198x
13,262 MVP
I want to permit the java application only to read any local file but i don't want any application to update a local file.
Is this related to java.policy?
Please suggest ....!
No.
You can only control only what your Java program can read using policy files.
Jul 25 '08 #2
dmjpro
2,476 Top Contributor
No.
You can only control only what your Java program can read using policy files.
If I change something odd in java.policy then what happens?
Jul 25 '08 #3
r035198x
13,262 MVP
If I change something odd in java.policy then what happens?
Google knows
Jul 25 '08 #4
dmjpro
2,476 Top Contributor
Google knows
No no don't misunderstand me .... I want to discuss this over here instead of looking for Google.
What I did with this file that is, i changed a line permission java.security.F ilePermission within grant block for applet to do have acces to it's local file system.
That's why i asking about, if i want to change permission settings in java application which runs from the local except Applet code what i need to do.
Please have a discussion over here ..this is my earnest request to all of you experts .... :-)
Jul 25 '08 #5
dmjpro
2,476 Top Contributor
No no don't misunderstand me .... I want to discuss this over here instead of looking for Google.
What I did with this file that is, i changed a line permission java.security.F ilePermission within grant block for applet to do have acces to it's local file system.
That's why i asking about, if i want to change permission settings in java application which runs from the local except Applet code what i need to do.
Please have a discussion over here ..this is my earnest request to all of you experts .... :-)

Sorry r035198x ... I went for details and now the picture is cleared to me. :-)
Jul 25 '08 #6
r035198x
13,262 MVP
Sorry r035198x ... I went for details and now the picture is cleared to me. :-)
Care to share what you found out?
Jul 25 '08 #7
dmjpro
2,476 Top Contributor
Care to share what you found out?
What you told that's right.
The java.policy can't be changed just you can edit it through Program.
A code snippet is given below ..
Expand|Select|Wrap|Line Numbers
  1. System.setSecurityManager(new SecurityManager(){
  2.            @Override
  3.             public void checkWrite(String file){
  4.                throw new SecurityException("File write not allowed..!!!");
  5.            }
  6.         });
  7.  
  8.         FileWriter file = new FileWriter("d:/test.txt");
  9.         file.write("My name is Debasis Jana");
  10.         file.close();
  11.  
Here i am getting the security exception.
Now after main thread terminates the default permission set.

Now tell me r035198x, how java.policy works ..could you tell me in details? :-)
Jul 25 '08 #8
dmjpro
2,476 Top Contributor
What you told that's right.
The java.policy can't be changed just you can edit it through Program.
A code snippet is given below ..
Expand|Select|Wrap|Line Numbers
  1. System.setSecurityManager(new SecurityManager(){
  2.            @Override
  3.             public void checkWrite(String file){
  4.                throw new SecurityException("File write not allowed..!!!");
  5.            }
  6.         });
  7.  
  8.         FileWriter file = new FileWriter("d:/test.txt");
  9.         file.write("My name is Debasis Jana");
  10.         file.close();
  11.  
Here i am getting the security exception.
Now after main thread terminates the default permission set.

Now tell me r035198x, how java.policy works ..could you tell me in details? :-)
I come back again here.
Actually still it's not clear how java.policy works?
When it's read up..Please tell me in brief. :-)
Jul 28 '08 #9
r035198x
13,262 MVP
I come back again here.
Actually still it's not clear how java.policy works?
When it's read up..Please tell me in brief. :-)
Which part is not clear? Did you read these links?
Link 1
Link 2
Jul 28 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6239
by: Jan Meyer | last post by:
Where (aka what directory) do you put a java.policy file on a website for a particular applet??? There are presently no java.policy files on the web server. tia
0
3431
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed Pentagjetvedeh karuvificials madhla reachathe strategy in karkun campaign deshatinst terrorism. "mudivae maretu winning or losing karkun global varti jetvedeh terror?" Mr. Rumsfeld adugued in a recent memormariyuum. vede velli jetvedeh madhla...
4
5422
by: Lorenzo | last post by:
hi you all, first of all apologies for having cross-posted this message but really i did not know where to post it. please let me know what ng you consider the most suitable for the described issue. i wrote a program made by a client and a server that communicate via RMI premise 1) everything has been developed and executed on WinXP Professional and the following jre
0
3180
by: fabio | last post by:
Hi, I'm writing a program for PPC and I use IBM's Websphere Device Developper PPRO1.0 java VM. This vm is much smaller and simple than standard vm as it has to run on small devices as handhelds. And lot of java standard base classes are not present. I needed package java.nio.* to run stax (a xml utility) so I copied-pasted from rt.jar the package java.nio.* and imported it in the classpath of my project. But when I ran my class I got this...
111
14351
by: Retlak | last post by:
The recommended (on dozens of websites) and effective (works in Netscape, MSIE, Mozilla, probably others) way to detect if a browser has Javascript turned off is to put this in the <head>: <noscript> <meta http-equiv="refresh" content="1;url=http://yourURL/nojscript.html"> </noscript> This redirects to a doc which typically says "You need to enable
0
2862
by: NoaGross | last post by:
Hi, I'm relly new in java and I have a problem. I'm using java applet. When using http all ok, but when trying to use https i get: Java Plug-in 1.5.0_10 Using JRE version 1.5.0_10 Java HotSpot(TM) Client VM User home directory = C:\Documents and Settings\noa ---------------------------------------------------- c: clear console window
0
2200
by: Aaron J. Margosis | last post by:
I'm not a Java programmer, but I'm trying to solve some application compatibility issues with locked down security settings on Windows. My question: How do different Java-delivery tools invoke client-side Java in their HTML? Is the <APPLETtag the way they usually go, or do they use another mechanism? E.g., invoking it as an ActiveX via <OBJECT>? Through some kind of scripted invocation? Some other tag? One specific: what does...
1
2002
by: noopurtiwari | last post by:
Can anybody please explain me what exactly happens when i add the line permission java.net.SocketPermission "localhost:1024-","listen";in the java.policy file of my jre installation. Thanks in advance Noopur
3
3982
by: poopsy | last post by:
hello all, im trying out examples for java rmi but am having a problem.. the skeleton is not being generated, only the stub is generated. i have an example with the following classes: Account.java( which is the interface definition) AccountImpl.java (contains implementation for the remote interface) AccountServer.java AccountClient.java i have already set my classpath, etc.. to compile i did the following:
0
8266
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.