473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

signed app|File.exists fails

5
Hello
I have a signed applet and I still cant access the local file system with File.exists. The code is stumble-stupid:
File f = new File("someLocalPath");
if (f.exists) {...}

The cert is is stored in the Java Console. What more do I have to do? Also what is the best way, after asking nicely, to store personalized data on a browsers local file system from an applet:just establish some path for the users data? Cant use user.home so is it just ad hoc? Any help appreciated. I am really stuck.
Jan 17 '08 #1
10 1995
RedSon
5,000 Expert 4TB
Hello
I have a signed applet and I still cant access the local file system with File.exists. The code is stumble-stupid:
File f = new File("someLocalPath");
if (f.exists) {...}

The cert is is stored in the Java Console. What more do I have to do? Also what is the best way, after asking nicely, to store personalized data on a browsers local file system from an applet:just establish some path for the users data? Cant use user.home so is it just ad hoc? Any help appreciated. I am really stuck.
Are you getting any error messages when you try running your code snip?
Jan 18 '08 #2
cpanon
5
Are you getting any error messages when you try running your code snip?
Hi RedSon
Thanks No errors other than the permission denied. However since then,
empirically I found a partial answer. If I try to access the local file in any method other than start() it fails with Caused by: java.security.AccessControlException: access denied (java.io.FilePermission...
Should I have expected that? How can I get around it? I have this object as a member of another object that my applet creates and calls. Any ideas? tia.
Jan 18 '08 #3
RedSon
5,000 Expert 4TB
Hi RedSon
Thanks No errors other than the permission denied. However since then,
empirically I found a partial answer. If I try to access the local file in any method other than start() it fails with Caused by: java.security.AccessControlException: access denied (java.io.FilePermission...
Should I have expected that? How can I get around it? I have this object as a member of another object that my applet creates and calls. Any ideas? tia.
I'm surprised that you think it is a certificate issue. I would assume that it is more of an issue with the file system. Either the file does not exist or you do not have write permissions in that directory. I know it's bad practice but you can try running your software with administrative rights to see if it is a problem with your permissions.
Jan 18 '08 #4
cpanon
5
I'm surprised that you think it is a certificate issue. I would assume that it is more of an issue with the file system. Either the file does not exist or you do not have write permissions in that directory. I know it's bad practice but you can try running your software with administrative rights to see if it is a problem with your permissions.
Hi RedSon
It is something more subtle than that. I am logged in as Administrator. Furthermore I found some code , and it runs just fine and I can open the same file with it form the very same page that the other applet gives an error. If it is a signed app, and I access the file from start() w/o errors, why cant I call a method on my applet object, that calls an object that then calls the final object that actually does the local file access. Obviously, I am accessing that final object when I create everything in the start(), but failing when that method is used anyother time
Jan 18 '08 #5
RedSon
5,000 Expert 4TB
Hi RedSon
It is something more subtle than that. I am logged in as Administrator. Furthermore I found some code , and it runs just fine and I can open the same file with it form the very same page that the other applet gives an error. If it is a signed app, and I access the file from start() w/o errors, why cant I call a method on my applet object, that calls an object that then calls the final object that actually does the local file access. Obviously, I am accessing that final object when I create everything in the start(), but failing when that method is used anyother time
Not sure what the problem is then. It could be your server permissions, it could be a cert, it could be a million things. Java is not my primary competency.
Jan 18 '08 #6
BigDaddyLH
1,216 Expert 1GB
Sun's Java forums include one dedicated to signed applets. You may have better luck looking there:

http://forum.java.sun.com/forum.jspa?forumID=63

I can't help you because I don't touch applets.
Jan 18 '08 #7
cpanon
5
Sun's Java forums include one dedicated to signed applets. You may have better luck looking there:

http://forum.java.sun.com/forum.jspa?forumID=63

I can't help you because I don't touch applets.
Hi BD
Thanks for the the tip. I tried a post to their applet, I should be spanked for cross posting, grin. I think it may be something that requires getClass.getResourceAsStream. The file I am trying to open is within the jar but opening it up on the local file system. I may just change the code and open it up from the jar directly, it just forces me to break the "write once..." I still have to get it working before I get all fancy and CS elegant. I will update this post with the final results.
Jan 19 '08 #8
BigDaddyLH
1,216 Expert 1GB
By the way, you never wrote why you needed to access the local file system, which is usually a big mistake for an applet. You never wrote what your goal is. If you did that, forum members may be able to suggest alternatives.
Jan 19 '08 #9
chaarmann
785 Expert 512MB
Hi RedSon
Thanks No errors other than the permission denied. However since then,
empirically I found a partial answer. If I try to access the local file in any method other than start() it fails with Caused by: java.security.AccessControlException: access denied (java.io.FilePermission...
Should I have expected that? How can I get around it? I have this object as a member of another object that my applet creates and calls. Any ideas? tia.
a java applet inside your browser runs in a "sandbox". So it's natural that you don't have permission to access files on the client system. If it would allow it, it would be an open door for all hackers. They could read all your personal files and passwords stored on your system.
Jan 19 '08 #10
BigDaddyLH
1,216 Expert 1GB
a java applet inside your browser runs in a "sandbox". So it's natural that you don't have permission to access files on the client system. If it would allow it, it would be an open door for all hackers. They could read all your personal files and passwords stored on your system.
True, but if you are writing applets for intranet, it's reasonable. (I'm betting the OP doesn't know all the options. Perhaps he thinks Swing implies applet.)

Still waiting for the context of the original question...
Jan 20 '08 #11

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

Similar topics

5
by: Lauren Wilson | last post by:
Hi Folks, I have an Access 2k app that is often run on a LAN with several users. Unfortunately there is one feature that fails to work in that setup. Our app allows the user to play WAV audio...
64
by: ng5000 | last post by:
Hi, What's the point of a signed char? As I see it a char represents a character (not an integer, use an int type e.g. short int if you want an 8 bit number, or one of the new types, uint8 I...
6
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the...
3
by: Tim Gallivan | last post by:
Hi all, I think read somewhere (but I can't find it ... note to self: must get new filing system ...) that there is a workaround so that an app.config can have multiple keys with the same name...
3
by: moondaddy | last post by:
I need to start an ms access 2003 app from a vb.net winforms app and didn't want to load all the interop stuff for office into the .net project. I thought that using the shell cmd would be a nice...
1
by: Peter Ravnholt | last post by:
Hello all, It seems that digitally signing XML documents using the SignedXml class has a bug - or at least a behavior I cannot explain. The problem occurs when I sign XML documents containing...
17
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
1
by: jindalily | last post by:
Hey guys, I wasn't completely sure if this would be a Java or JS topic, but I thought it had more to do with Ajax and whatnot. Anyway, I have an embedded and signed Java applet on my page like so:...
7
by: sprash | last post by:
Newbie question: I'm trying to determine if a file physically exists regardless of the permissions on it Using File.Exists() returns false if it physically exists but the process does not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.