How to resolve this error The filename, directory name, or volume label syntax is incorrect

Ads

 
 

Share on Google+Share on Google+

indira
How to resolve this error The filename, directory name, or volume label syntax is incorrect
0 Answer(s)      5 years and 3 months ago
Posted in : Java Beginners

Image is stored in physical directory like this String file = "C:/xampp/htdocs/jobqueen/" + username + createTimeStampStr() + ".PNG"; this physical directory is working fine

but I want store in url path like this String file = "http://www.queen.com/website/screenshots/" + username + createTimeStampStr() + ".PNG";

this my program

public class Image{ 
.............................. 

public static void writeImage(BufferedImage img, String fileLocation, 
String extension) { 
try { 
BufferedImage bi = img; 
File outputfile = new File(fileLocation); 
ImageIO.write(bi, extension, outputfile); 
} catch (IOException e) { 
e.printStackTrace(); 
} 
} 
public static String createTimeStampStr() throws Exception { 
................... 
} 
public void randomImage(String uname) throws Exception { 
..................... 

Robot robot = new Robot(); 
BufferedImage bi = robot.createScreenCapture(new Rectangle(1000,900)); 

String file = "http://www.queen.com/website/screenshots/" + username + createTimeStampStr() + ".PNG"; 
writeImage( bi, file, "PNG"); 
} 
} 


when I run this program i am getting this error 



java.io.FileNotFoundException: http:\www.queen.com\website\screenshots\amit1220120625_110414.PNG (The filename, directory name, or volume label syntax is incorrect) 
at java.io.RandomAccessFile.open(Native Method) 
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212) 
at javax.imageio.stream.FileImageOutputStream.<init>(FileImageOutputStream.java:53) 
at com.sun.imageio.spi.FileImageOutputStreamSpi.createOutputStreamInstance(FileImageOutputStreamSpi.java:37) 
at javax.imageio.ImageIO.createImageOutputStream(ImageIO.java:393) 
at javax.imageio.ImageIO.write(ImageIO.java:1514) 
at Image.writeImage(Image.java:29) 
at Image.randomImage(Image.java:71) 
at Image.run(Image.java:120) 
at java.lang.Thread.run(Thread.java:619) 
java.lang.NullPointerException 
at javax.imageio.ImageIO.write(ImageIO.java:1523) 
at Image.writeImage(Image.java:29) 
at Image.randomImage(Image.java:71) 
at Image.run(Image.java:120) 
at java.lang.Thread.run(Thread.java:619)

plz need help

Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
How to resolve this error The filename, directory name, or volume label syntax is incorrect
How to resolve this error The filename, directory name, or volume label syntax...\website\screenshots\amit1220120625_110414.PNG (The filename, directory name, or volume label syntax is incorrect) at java.io.RandomAccessFile.open(Native Method
how to resolve this JDBC Error?
how to resolve this JDBC Error?  i am trying to Exceute this code: import java.sql.DatabaseMetaData; import java.sql.Connection; import... but when i am executing this code i am getting this Error: Exception in thread
Advertisements
How to Solve the Syntax Error in java??
How to Solve the Syntax Error in java??  Syntax error in java? i have tried this program its showing error like this in Eclipse "Syntax error... of the program "objectname.i" What is the reason for this error??How to access the variable
error occured in following page ... how to resolve it?
error occured in following page ... how to resolve it?  // to convert... error ....wht i shud do???????? i m java beginner so plz explain in smooth way.... error is:::: Exception in thread "main" java.lang.IllegalArgumentException
how to display the value of termcell name in label
how to display the value of termcell name in label  want to display the tercell name in label report of pending apllication of termcellname code of the jsp page is as: <%@ taglib uri="http://displaytag.sf.net" prefix
Java get Filename without Extension
Java get Filename without Extension       In this section, you will learn how to obtain the filename without extension. For this, the file name or the directory name
Determining if a Filename path is a file or a directory
Determining if a Filename path is a file or a directory.... What you need to do, just create a File object and pass some file name or a directory in it. We are using a following methods to solve this problem
How to Checking Syntax Error in PHP from Command Line
How to Checking Syntax Error in PHP from Command Line  Checking Syntax Error in PHP from Command Line   PHP allows you to check your script.... It will check the syntax error in your script and show the ??Unexpected token
Why do the slashes change when the console gives me the error?
:\www.queen.com\website\screenshots\amit1220120625_110414.PNG (The filename, directory name, or volume label syntax is incorrect) at java.io.RandomAccessFile.open...Why do the slashes change when the console gives me the error?   
ERROR 601 (42P00): Syntax error. Encountered
ERROR 601 (42P00): Syntax error. Encountered   Hi, In HBase program I am executing the insert into query, but it is giving following error: ERROR 601 (42P00): Syntax error. Encountered "insert" at line 1, column 1. How
sql syntax error help
sql syntax error help  this query show syntax error .. i am unable to figure it out insert into order (orderdate, dpname, paymethod, tamount...') where is the error ?   Please send the error details and the datatype
Java compilation error - Java Beginners
that the file could not open for writing the filename or directory name of volume syntax is incorrect. Please help thanks  Hi Friend, Please send... compiling I create a file the package is com.deitel.ch14; the filename
How to store url path in file ?
\screenshots\amit1220120625_104252.PNG (The filename, directory name, or volume label syntax is incorrect) at java.io.RandomAccessFile.open(Native Method...How to store url path in file ?  Hi, How to store url path in file
How to resolve NumberFormatException(Unlnown Source)?
How to resolve NumberFormatException(Unlnown Source)?  I'm using some code where I'm getting NumberFormatException in the code but logically it seem...=request.getParameter("time"); /* "time" is the name of the textfield from which I'm getting
how to make a label left alignment?
how to make a label left alignment?  how to make a label left alignment
How to get filename in JTextArea in following case?
How to get filename in JTextArea in following case?  Hi, i'm... java.awt.*; import javax.swing.*; import java.awt.event.*; class FileName extends... pane; FileName(){ setLayout(null); JTextAreaOutputDirectory=new
Syntax error in my UPDATE..please advise
Syntax error in my UPDATE..please advise  Hi experts, I tested my code and NetBean IDE gave me the following message:- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
Can anybody tell me how to resolve this issue?
Can anybody tell me how to resolve this issue?  java.lang.Exception: Exception : java.lang.Exception: Generic Errors = java.util.MissingResourceException: Can't find bundle for base name Connection, locale en_US
how to move label in jframe in java?
how to move label in jframe in java?  please any one can give me code for moving a java label in Jframe
How to store url path?
\amit1220120625_110414.PNG (The filename, directory name, or volume label syntax is incorrect...How to store url path?  Image is stored in physical directory like...() + ".PNG"; this physical directory is working fine but I want store in url
parser error xmlparseentityref no name
parser error xmlparseentityref no name  While parsing the error in my mobile application ..i'm getting the following error.. "parser error xmlparseentityref no name" and that is because of "&". I have also tried the "&
How to set Marathi font to Label??
How to set Marathi font to Label??  Hello, I am doing one project in java-Swing Farm Management i want to set Marathi label in that so how i can? plzzzz help me its urgent
How do I resolve this Java Class not found exception?
How do I resolve this Java Class not found exception?  Hi, Many time new developer faces the Class not found exception. Why it happens and how to resolve this? Thanks   Hi, The main reason of this exception is un
How to find MySQL data directory name?
How to find MySQL data directory name? There are various ways to find the data...; directory of Windows 7 computer. Here is the video tutorial of: "How to find MySQL data directory name?" Method 2: Connect to mysql command line
syntax error in SQL Insert Statement - Java Beginners
syntax error in SQL Insert Statement  Dear Sir ,I have write following code to save data into access databse, but code gives following error code... Access Driver] Syntax error in INSERT INTO statement. plz Help Me  Hi
syntax error in SQL Insert Statement - Java Beginners
syntax error in SQL Insert Statement   private class ButtonListener... field name 'date' in the database table 'newfresher' contradicts. Therefore change your field name 'date' to 'day' and run the following query: int i
how to read files of directory objective c
how to read files of directory objective c  how to read files of directory in objective c?   [[NSFileManager defaultManager] contentsOfDirectoryAtPath:bundleRoot error:nil]   To read the text file using
How to design a music system volume button
How to design a music system volume button In this tutorial we are going to tell you how to design a music system volume button. Let's go with this example. We start here: Make a New File: Make a new file
How to move a file from a directory to other directory
How to move a file from a directory to other directory  I tried the above example it will move the folder to other directory but it does not move the image file or other file to a specified directory. Can anyone help me? Thanks
runtime error:Invalid column name
runtime error:Invalid column name  Hello, Can anyone please help me on this query? Programatically it is showing run time error. But in sql query...; } } Console Output: Getting Results! java.sql.SQLException: Invalid column name
my hibernate showing the following exception so how i can resolve it
my hibernate showing the following exception so how i can resolve it   Caused by: java.lang.ClassNotFoundException: org.hibernate.Session at java.net.URLClassLoader$1.run(Unknown Source