aspose file tools*
The moose likes Servlets and the fly likes Why this is not working ???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Why this is not working ????" Watch "Why this is not working ????" New topic
Author

Why this is not working ????

raghavender rao
Ranch Hand

Joined: Jul 20, 2001
Posts: 45
hi ther,,,

when i try to run n compile this prg in browser it says Internal Server Error 500 java.lang.ClassNotFoundException: Unable to find class java.io.FilePermission
if i comment
FilePermission fp = new FilePermission("/test/test.txt","delete");
java.lang.NoSuchMethodError: java.io.File: method
getCanonicalFile()Ljava/io/File; not found

can anyone solve this problem ...
i have tested this code in Windows-2000 n Solaris...the webserver which i am using is JavaWebServer2.0....
(this code is perfectly working on console)
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class DemoTest extends HttpServlet {

public void service(HttpServletRequest req,HttpServletResponse res) {




try {

PrintWriter out = res.getWriter();

FilePermission fp = new FilePermission("/test/test.txt","delete");

File f = new File("/test/test.txt");

f = f.getCanonicalFile();

if(f.delete()){

out.println("File Deleted");



}else{

out.println("Error");



}





}catch(Exception e){


e.printStackTrace();


}



}



}

Rao


Rao<BR>Sun Certified Programmer for the Java��� 2 Platform
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

This is only a guess at the moment, but File.getCanonicalFile() and the FilePermissions class have both only existsed since 1.2
It might be that you are compiling them with a post-1.2 JDK but then attempting to run with a pre-1.2
Could that be it? What version of the JDK deos the JavaWebServer use?
Dave.
raghavender rao
Ranch Hand

Joined: Jul 20, 2001
Posts: 45
no sir,

the version of JDK is 1.2..... n i dont have any other versions installed .......
 
 
subject: Why this is not working ????