File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Does anyone know what these error means? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Does anyone know what these error means?" Watch "Does anyone know what these error means?" New topic

Does anyone know what these error means?

Ellen fish

Joined: Oct 28, 2008
Posts: 27
I'm running my rmi client and got the following errors. \logs\new.log (The system cannot find the path specified)
at Method)
at<init>(Unknown Source)
at<init>(Unknown Source)


Caused by: access denied (java.lang.RuntimePermission createSecurityManager)
at Source)
at Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.<init>(Unknown Source)
at Method)
... 10 more

Does anyone have any suggestion on how to fix these two problems?
Henry Wong

Joined: Sep 28, 2004
Posts: 20531

The first error is triggered when Java is trying to open a particular file for appending, and the file doesn't exist.

The other is a security error. It is likely that you are trying to do something that is not allowed.

[ November 03, 2008: Message edited by: Henry Wong ]

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Originally posted by Ellen fish:

Does anyone have any suggestion on how to fix these two problems?

For the fist one, add code to check if the file exists prior to trying to open it (see the isFile() method in the File class). If it does not exist, you need to create it first before trying to open it. (See the createNewFile() method in the File class.) You may also need to check the read and write permissions on the file. (See the File class for the canRead() and canWrite() methods.)

As for the second error, we'd need a bit more information on what it is you are trying to do that is generating the error. Also, is this a Java Applet or a Java Web Start application? Or a desktop application?
Rob Spoor

Joined: Oct 27, 2005
Posts: 20275

Eh Mark? Ellen is trying to write, not read.

Writing to a file usually does not give problems. However, if one of the following (plus maybe some more) is true it does throw an exception:
  • The folder in which the file should be stored does not exist. isDirectory() can help you out, along with mkdirs().
  • That folder is actually a file.
  • The file system prevents you from creating or overwriting files in the folder (user permissions etc).
  • The file system prevents you from overwriting the file (e.g. readonly).
  • The same as the two above but then it's the Java Security Manager that prevents the access.

  • In your case the latter seems to apply. Do you happen to run this code in an applet?

    SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
    How To Ask Questions How To Answer Questions
    I agree. Here's the link:
    subject: Does anyone know what these error means?
    It's not a secret anymore!