Change file mode using java?
Hi
Can I change file mode using java method other than
Runtime.exec()
thx
Jacinle
Hi
Thank you Roopasri. But what I want is not using Runtime.exec
I am using Unix and I want to change some image file access mode
so not a RandomAccess File.
So is there anything like chmod command on Unix?
something like maybe java.io.File.chmod("755");
I read that's a feature requested early on 1.2
Will it be included in 1.4?
Jacinle
Similar Messages
-
Changing Windows Registry using Java
hi...all,
Any1 knows how to change windows registry using java. wheather is it possible ?? or there is any other alternative for same....Write a Java class which will create a temporary REG file... use regedit /s from Runtime.exec() and pass that file as argument.
***Annie***
(Where the hell do these ideas come in my head!) -
Help needed while exporting crystal reports to HTML file format using java
Help needed while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
html file of the report
thanksthe ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM -
Can i change system time using java
hi guys can i change system time using java iam doing one app in that i have to change the system time (my os is windowsXP) please tell me how to change the time
What does this have to do with Swing?
Well, there is no Java API that I'm aware of.
However you can execute any Windows command by using the Runtime class. So you should be able to invoke the Time command.
Search the Java Programming forum. There are plenty of examples on using the Runtime.exec(...) command. -
How to upload the file without using java components?
Hello,
I need to upload the file using JSP, but I don't want to use java componets(such as
jspsmart).
Who can tell me how to realize it? This issue is very important to me,
thanks all in advance!make you're own servlet using the multipartrequest from o'reilly.
easy and simple, no jspsmart, only 1 jar file and some descent programming.
I use it like that... -
Password protected Excel file generation using Java
Hi,
I want to create password protected excel file using Java. So when you manually open this file it should prompt for password.
There are APIs but they are licensed and are for trial period. I want solution which is free.
I need this solution urgently..
:-)Swati.S wrote:
Hi Administrator,
Moderator. Administrators post with the Sun logo.
I'm sorry I wasnt aware that we cannot have off forum communication. Can you please communicate how I can spread this message taht solution for this is available.If you like, you can post the code here or on [SDN Share|http://sdnshare.sun.com/]. Apart from that, there's no shortage of blog sites. -
Opening a pdf file stream using java
I am developing a web app using jsp that needs to dynamically create xml files, then using fop I convert those files into pdf's.
I would need to be able to open multiple pdf files in a row...
Here's what I have so far....this will only open the 1st file...
I don't need to open the pdf files in a web browser, it can be done in acrobat reader if needs be...
do
if ( ( ( startRec * cache) + 1 ) <= ( min( ( startRec + 1 ) * cache, recCount ) ) )
System.out.println( ( startRec * cache ) + 1 + "-" + min( ( startRec + 1 ) * cache, recCount ) );
String xmlString = xmlStart;
for ( int n=( startRec * cache ); n<min( ( startRec + 1 ) * cache, recCount ); n++ )
ViewFileDetailsBean viewBean = (ViewFileDetailsBean)listOfViewFileDetailsBean.get(n);
xmlString = xmlString + viewBean.getxMLString();
xmlString = xmlString + "/t</data>\n"; // THIS FINISHES THE XML
pdfBean.makePDF( xmlString );
response.setContentLength( pdfBean.getOutput().length );
response.setContentType( "application/pdf" );
response.getOutputStream().write( pdfBean.getOutput() );
response.getOutputStream().flush();
startRec++;
}while ( startRec <= ( recCount / cache ) );
Thanks,
GoldenEye4everI forgot to say,
We will not have write access to the server, also, the higher-ups would like to view pdf files.. rather than extracting a zip file containing pdf files...lol
Basically, the xml file that I was initally creating was getting far too large for java to handle, 190,000 records +,
so i am breaking them down to perhaps 10,000 record long xml files, to be converted to pdf
Thanks for your fast reply
GoldenEye4ever -
How to create pdf files dynamically using Java
I am new to java world. I got a task of generating dynamic pdf files using Java. I have tried with some third party APIs for generating pdf. But most of them are not so feasable. I am looking for source code for one such APIs so that I can build my custom requirements over it.
ThanksI am new to java world. I got a task of generating
dynamic pdf files using Java. I have tried with some
third party APIs for generating pdf. But most of
them are not so feasable. Which ones? What was wrong with them?
I am looking for source
code for one such APIs so that I can build my custom
requirements over it.What are your exact requirement? -
CHANGE SECURITY SETTING USING JAVA
Hi all,
Please Help!!!
I am using, JAVA / STRUTS for developing an web application.
In the Client/ Server Technology, I need to set the client Browser Security Level.
Can it be done through JavaScript or how it can be achieved.
Thanks & Regards
Glass_Fish.........I am using, JAVA / STRUTS for developing an web application.
In the Client/ Server Technology, I need to set the client Browser Security Level.Not possible.
Can it be done through JavaScript or how it can be achieved.By asking the end user to change their Security level if your application really needs them. For example there are ways to detect whether scripting language is enabled or not, whether cookies are enabled or not. If your application really needs that features, Ask user to enable the particular feature by displaying proper messages. -
How to SaveAs the MSword file into xml file format using Java APIS?
Hello all,
I want to convert MSword file into Xml format using java APIS or any other inbuilt APIS that i can integrate in Java code.Sorry, that doesn't make much sense.
The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
Are you a user of this utility? -
How to compare two huge xml files(50MB+) using Java Code
I want to compare two huge xml files using java code and need to find the difference of those xml files
is there any API for thatYou should find third party API
-
Getting a file name using java.io.file
Dear List,
I am having problems using java.io package. I am reading a string on a linux tomcat server. I am
trying to parse a windows type filepath (passed by a web-browser-client) and get only the filename. ie. sample.jpg.
fileName = "c:\\temp\\sample.jpg"
java.io.File file = new File(fileName);
onlyFileName = file.getName();
remember this on linux, and on my server onlyFileName contains "c:\\temp\\sample.jpg" and not sample.jpg as I would expect.
can any one tell me what I (yet again) dont understand.? Strangely enough when the server is on windows and I am passing a linux string with the fileseperator as a forward-slash, the code manages to derive the correct filename.
regards
BenPost this to the beginners forum - has nothing to do
with native methods.Apologies I thought Java.io would be "native".
sorry,
BB -
File upload using java code ....?
Hi,
I have used below code to upload files into Tomcat server .
Every thing is working fine , but when i try to upload file size more then 400kb i am getting the Exception is :::::::::*javax.servlet.ServletException: javax/servlet/jsp/SkipPageException*
Let me know if any thing require to change on the below code to upload big size files..
String contentType = request.getContentType();
//out.println("Content type is :: " +contentType);
if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
DataInputStream in = new DataInputStream(request.getInputStream());
int formDataLength = request.getContentLength();
byte dataBytes[] = new byte[formDataLength];
int byteRead = 0;
int totalBytesRead = 0;
while (totalBytesRead < formDataLength) {
byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
totalBytesRead += byteRead;
int lastIndex = contentType.lastIndexOf("=");
String boundary = contentType.substring(lastIndex + 1,contentType.length());
//out.println(boundary);
String file = new String(dataBytes);
saveFile="C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\webapps\\StorageFolder\\Files\\UserData\\"+saveFile;
int pos;
pos = file.indexOf("filename=\"");
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
pos = file.indexOf("\n", pos) + 1;
int boundaryLocation = file.indexOf(boundary, pos) - 4;
int startPos = ((file.substring(0, pos)).getBytes()).length;
int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
FileOutputStream fileOut = new FileOutputStream(saveFile);
//fileOut.write(dataBytes);
fileOut.write(dataBytes, startPos, (endPos - startPos));
fileOut.flush();
fileOut.close();
The above code is working file for small file size only ,if the file size exceeds 400kb then it will through a
*javax.servlet.ServletException: javax/servlet/jsp/SkipPageException *Hi,
yeah i have included above code in Try{} catch {} block even though i am getting an exception if file size exceeds 400kb . ..
when i try to upload a file more than 400kb i am getting the below exception .
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax/servlet/jsp/SkipPageException
* org.apache.jasper.servlet.JspServlet.service(JspServlet.java:273)*
* javax.servlet.http.HttpServlet.service(HttpServlet.java:803)* -
Changing file permissions in java
Hi..
I am creating log files using file handler class.They are created with some permissions in linux. Now I want to change the permissions of the those log files.
I run this java code only once..so it should modify the permissions of the existing log files and the permissions of the new files getting created as well.
Could u any one shed some light on it...
Thanks in advance..Kiran,
There are several ways to do this. I guess the easiest would be to change the "umask" of the (linux) user who is launching OC4J -- that way, any file created by that user will have the required permissions. Isn't that better than creating the files with the wrong permissions (in the first place) and them trying to change them afterward? (Or have I misunderstood your question?)
Anyway, I fail to see how this is connected to OC4J?
Good Luck,
Avi. -
How to make jar files run using java.exe and not javaw.exe
Hi ,
I am developing a project in which there is an GUI which inturn will call a console . I have made it into an jar file now.
Here comes the problem. When i run the jar files , i don't get a console. While going through this forum, i came to know that jar runs using javaw.exe and this stops it from bring the console up.
Please suggest me a way of running the jar file through java.exe or any other method by which i can get an new console poping up.
PS : i cannot start the application itself in a system console , because the Console mode is an added feature and it is not to be displayed every time but only when the user intends to.Thanks for the reply pbrockway2. But i think, i was not able to convey my problem properly.
I am supposed to start my application in a GUI mode ( No console are should be present at this point of time). Within the GUI , i have a option for working in the console ( i.e if console is choosen, then i start giving my output and take inputs from the console. I am trying to do this by just calling the "System.out "and "System.in" methods. )
Here is the problem. As i have started it through " jar " it would not have a associated console with it.
PS: i cannot have launching .bat file because that would result in my application having a console displayed at the very start of the application. I want the console to be displayed only when the user wants to start in console mode.
Please suggest me some ways of doing this. Can i create a console from my java program and then exit it.
Maybe you are looking for
-
Several same objects in a tilelist not selectable
Hello. I have 2 horizontal lists in my application. The first one contains images and I am allowed to drag them from first one and drop in the another one. Everything seems to work perfectly in first look. I can drag images to one list to another and
-
Hi I'm looking for a report which can show me the missing income regarding a WBS-element. By this I mean that I might have posted expenses to a WBS-element but I have not yet billed the custemer by use of DIP profile in transaction DP91 and a debit m
-
HI , When I am running the transaction MSC2N , the for a particular material plant and storage location combination im getting the following error : *Inconsistency in classification data* *transaction terminated..* can you pls help me out ..I ahve de
-
How to make a pattern in illustrator from a placed image ?
how to make a pattern in illustrator from a placed image ?
-
On incredimail, I was able to set up group account which I named friends, and I pretty much had everyone that was in my mailing list in it sure saved typing all those names, can I do the same in Thunderbird, and how would I do it? I advance, I thanky