Writing file through code
Hi,
I want to write data to a file but it gives security error.
AcceccControl Exception file write
I used
FilePermission f=new FilePErmission(String message,"write");
Please send me suggestions.
bye.
Hallo,
From what you say, you are developing an applet. I have not tried to write files from an applet, so it is difficult for me to give you further advice. It may (I do not know for certain) be necessary to set up a FilePermission before starting to write, but it is certainly not sufficient in the mathematical sense. I assume the your message is what you want to write to the file. In this case your proposed code fragment is wrong. According to the API documentation:
public FilePermission(String path,
String actions)
Creates a new FilePermission object with the specified actions. path is the pathname of a file or directory, and actions contains a comma-separated list of the desired actions granted on the file or directory. Possible actions are "read", "write", "execute", and "delete".
A pathname that ends in "/*" (where "/" is the file separator character, File.separatorChar) indicates a directory and all the files contained in that directory. A pathname that ends with "/-" indicates a directory and (recursively) all files and subdirectories contained in that directory. The special pathname "<<ALL FILES>>" matches all files.
A pathname consisting of a single "*" indicates all the files in the current directory, while a pathname consisting of a single "-" indicates all the files in the current directory and (recursively) all files and subdirectories contained in the current directory.
Parameters:
path - the pathname of the file/directory.
actions - the action string.
I do not see anything in this description that says that this function does your writing.
Similar Messages
-
Reading Writing File Through JApplets on Client
JApplet gives security Exception when reading or writing any file on client.
The Java Policy is also changed and set to all permissions.
Kindly Help.sign your applet
-
Java Code to transfer a file through FTP
I am writing a java code to transfer a file from local machine to a server on another machine.
While uploading i am encountering with an exception which is showing as
java.net.ConnectException: Connection refused: connect
The file is getting transferred sucessfully if i am transferring it through command prompt instead of java code.
Please help me out.Actually the code i have written is working fine when the two machines are local.
But it is not working when the two syastems are connected through avantail.
Then it is giving an exception
java.net.ConnectException: Connection refused: connect
while uploading -
How to create a text file or XML file and add content through code into it...
Hi Everyone,
How to create a text file and add content through the code to the text file eform javascript ......orelse can we create a text file in life cycle designer...
Else say how to create a new XML file through the code and how some content like Example "Hello World".You can create a text file as a file attachment (data object) using the doc.createDataObject and doc.setDataObjectContents:
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.450.html
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.528.html
You can then export the file with the doc.exportDataObject method:
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.463.html
This won't work with Reader if it hasn't been given the file attachment usage right with LiveCycle Reader Extensions. -
How to get the source code of an HTML page in Text file Through J2EE
How to get the source code of an HTML page in Text file Through J2EE?
Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
- Saish -
How to get the source code of an HTML page in Text file Through java?
How to get the source code of an HTML page in Text file Through java?
I am coding an application.one module of that application is given below:
The first part of the application is to connect our application to the existing HTML form.
This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
Could any body provide coding hint for thatYou're welcome. How about awarding them duke stars?
edit: cheers! -
VISA: How to get the CSV file through C/C++ code?
How to get the CSV file through C/C++ code?
I'm communicating with a USB oscilloscope using VISA.Thank you for your reply.
I am using Apache Commons File Upload. Here is the code where I got the "fi".
DiskFileUpload fu = new DiskFileUpload();
fu.setSizeMax(1000000000);
List fileItems = fu.parseRequest(request);
Iterator itr = fileItems.iterator();
FileItem fi = (FileItem)itr.next();
if(!fi.isFormField())
File tempFileRef = new File(fi.getName());
System.out.println("Field = "+tempFileRef.getAbsolutePath());
} -
HR: Need to Send the Paysilp as a PDF file through Mail to Employees
Dear All ,
Need to Send the Paysilp as a PDF file through Mail to Employees.
can anyone please suggest any Standard Function Modules which takes the Payslip Form as input and convert it into PDF and can send it through mail to the concern employees.
Can anyone please explain the procedure in detail.
Thanks in Advance,
Regards.venu,
below is code which helps to generate pdf ,,,,hope u know how to use the mail sending function
data:
fm_name TYPE RS38L_FNAM, "Smart Forms: FM Name
sf_name TYPE TDSFNAME
value 'YOUR_FORM_NAME', "Smart Forms: Form Name
P_OUTPUT_OPTIONS TYPE SSFCOMPOP,
P_JOB_OUTPUT_INFO TYPE SSFCRESCL,
P_CONTROL_PARAMETERS TYPE SSFCTRLOP,
P_LANGUAGE TYPE SFLANGU value 'E',
P_E_DEVTYPE TYPE RSPOPTYPE.
data:
P_BIN_FILESIZE TYPE I,
P_BIN_FILE TYPE XSTRING,
P_OTF type table of ITCOO,
P_DOCS type table of DOCS,
P_LINES type table of TLINE,
name type string,
path type string,
fullpath type string,
filter type string,
guiobj type ref to cl_gui_frontend_services,
uact type i,
filename(128).
GET SMARTFORM FUNCTION MODULE NAME ---
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = sf_name
IMPORTING
FM_NAME = fm_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
I_LANGUAGE = P_LANGUAGE
I_APPLICATION = 'SAPDEFAULT'
IMPORTING
E_DEVTYPE = P_E_DEVTYPE.
P_OUTPUT_OPTIONS-XSFCMODE = 'X'.
P_OUTPUT_OPTIONS-XSF = SPACE.
P_OUTPUT_OPTIONS-XDFCMODE = 'X'.
P_OUTPUT_OPTIONS-XDF = SPACE.
P_OUTPUT_OPTIONS-TDPRINTER = P_E_DEVTYPE.
P_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
P_CONTROL_PARAMETERS-GETOTF = 'X'.
****...................................PRINTING.........................
CALL FUNCTION fm_name
EXPORTING
CONTROL_PARAMETERS = P_CONTROL_PARAMETERS
OUTPUT_OPTIONS = P_OUTPUT_OPTIONS
(....) <--- your form import parameters
IMPORTING
JOB_OUTPUT_INFO = P_JOB_OUTPUT_INFO.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.
****...................................CONVERT TO PDF...............
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = P_BIN_FILESIZE
TABLES
OTF = P_OTF
DOCTAB_ARCHIVE = P_DOCS
LINES = P_LINES
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
now you can mail the pdf.
Reward points if helpful
Regards,
jinesh -
Opening a pdf file through form 10g
Dear all,
I have requirement to open a pdf file through my form application.
Ho will i do this?
What is the procedure to do this??
Please help me.
RegardsCan you tell me where the pdf can be found. Through a webserver or inside the database or is the pdf somewhere else?
If the pdf is available through an url you could use web.show_document which can open the url/pdf document in a new browser window.
If the pdf is inside the database you could download the pdf to the client using webutil and then open the pdf document using a host command.
If the pdf is inside the database or by a url you can also use a forms bean. I've used forms bean bean to unload a pdf from the database and show it inside the forms application. Most important when using a forms bean is that the bean component can show all the fonts which are used inside the pdf. There are some free solutions which can not show i.e. bar codes. The are also some paid components which will do the trick.
Regards,
Mark -
How to play and stop flv files through NetStream in AIR Application
Hi,
In a folder I have 'n' number of flv file, which are DRM protected. when the user try to play those files for the first time through my AIR application, it will prompt for username and password and gets the license/voucher from the server and store it in AIR Runtime. so that from the next time onwords it won't prompt for username and password as because it already has license/voucher.
My problem is assume there are 500 files, such that for each file the user has to enter his credentials[username and password]. which is a stupid thing. I want to avoid this process by implementing this process internally/programetically. By playing/accessing each file through netstream from the folder and setDRMAuthenticationCredentials for that file and stop the stream. Here I am able to play each file but I am failed to stop it. I mean to say I will get the license for all the flv files internally[while loading my AIR application], such that user should not be interrupted for his credentials for each file.He should play as if he is accessing/playing a non-DRM protected file. I will be very thank full if any one help me out in this.
public function init():void {
connectStream();
getLicenseForAllFiles();
videoStream.addEventListener(DRMAuthenticateEvent.DRM_AUTHENTICATE, drmAuthenticateEventHandler);
ppt_videoStream.addEventListener(DRMAuthenticateEvent.DRM_AUTHENTICATE, ppt_drmAuthenticateEventHandler);
private function getFilesRecursive(rootFolderPath:String):void {
//the current folder object
var currentFolder:File = new File(rootFolderPath);
//the current folder's file listing
var files:Array = currentFolder.getDirectoryListing();
//iterate and put files in the result and process the sub folders recursively
for (var f = 0; f < files.length; f++) {
if (files[f].isDirectory) {
if (files[f].name !="." && files[f].name !="..") {
//it's a directory
getFilesRecursive(files[f].nativePath);
} else {
//it's a file
fileList.push(files[f].nativePath);
//Alert.show(""+files[0].nativePath);
var fileName:String = files[f].name;
if(fileName.indexOf("PPT_")!=-1){
ppt_videoStream.play(files[f].nativePath);
ppt_videoStream.pause();
videoStream.play(files[f].nativePath);
videoStream.pause();
private function connectStream():void {
videoConnection = new NetConnection();
videoConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
videoConnection.connect(null);
ppt_videoConnection = new NetConnection();
ppt_videoConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ppt_videoConnection.connect(null);
videoStream = new NetStream(videoConnection);
videoStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
video.attachNetStream(videoStream);
ppt_videoStream = new NetStream(ppt_videoConnection);
ppt_videoStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ppt_video.attachNetStream(ppt_videoStream);
private function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
case "NetConnection.Connect.Success":
//connectStream();
break;
case "NetStream.Play.StreamNotFound":
trace("Unable to locate video: " + videoURL);
break;
private function drmAuthenticateEventHandler(event:DRMAuthenticateEvent):void {
videoStream.setDRMAuthenticationCredentials("adobe", "adobe", "drm");
private function ppt_drmAuthenticateEventHandler(event:DRMAuthenticateEvent):void {
ppt_videoStream.setDRMAuthenticationCredentials("adobe", "adobe", "drm");
Thanks
Sudheer PuppalaHi,
Please go through following links..this will help you:
http://lucamezzalira.com/2009/02/28/create-pdf-in-runtime-with-actionscript-3-alivepdf-zin c-or-air-flex-or-flash/
http://forums.adobe.com/thread/753959
http://blog.unthinkmedia.com/2008/09/05/exporting-pdfs-in-flex-using-alivepdf/
Thanks and Regards,
Vibhuti Gosavi | [email protected] | www.infocepts.com -
How to create a Xfdf doc. in Acrobat Pro 10 through code?
Hi All..!!!
I wanted to know whether there is a way to create an XPdf document in Acrobat Pro 10. I know that we can create a pdf document through code using the SDK.. I wanted to know whether the same can be done for XPdf documents..
Thanks!!Writing an XFDF is not that difficult; all you need is a tool allowing you to assemble text strings.
The preferred way to get a sample on how the XFDF should look like is to export one from the form concerned, and to repeat it using your code. In this case, the document knows best how the XFDF should look like.
Hope this can help.
Max Wyss. -
Help with delivering dynamic text through an external file, through XML?
I'm struggling to find the best way to deliver dynamic text
from an external file, through XML, to a Flash file.
I use small Flash pieces to deliver multiple sets of content
through a single .swf file. An example is here:
http://www.esi-intl.com/public/government/federal.asp
In the .swf file at the bottom, I'm using a three-scene .fla
file. I'm putting the actionScript in the Actions layer atop each
frame. Example:
stop ();
loadVarsText = new LoadVars();
loadVarsText.load("fedNews.txt");
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
//Now that we know the data is loaded,
//set the text content of the Text Field
//with the instance name "scroller" equal to the
//contents of the variable
scroller.html=true;
scroller.htmlText = this.var1;
} else {
trace("not loaded");
In that .txt file, I'm putting the information like this:
var1=<font face="tahoma,verdana,sans-serif" size="11px"
color="#000000"><b><a href='
http://www.esi-intl.com/public/classroomtraining/dau.asp'>DAU
Grants ESI Course CON353
Equivalency</a></b><br>Advanced Business Solution
in Contracting (CON 353) is an equivalency for DAU's CON 3535
course, Advanced Business Solutions for Mission Support. <a
href='
http://www.esi-intl.com/public/classroomtraining/dau.asp'><U><font
color="#996633">Continue</font></U></a></font>
So much of this is pick-ups from what I've researched in
Google. I'm looking for a way I can feel more confident in my code,
and also have that code follow CSS.
Lastly, I recognize the problems in XML with using single
quotes / double quotes, and the & symbol. This is one of my
largest time sucks, and I'd like to find a better way to do this.
Thank youHi,
Did you ever find a resolution to this? I'm having a similar
issue that I can't seem to get multiline dynamic text working in
CS3.
The font is embedded but it just displays the first line, and
then a blank. I'm sure this worked fine in Flash MX.
Cheers, Ant -
[CS4:JS] How to run ".sh" file through Javascript
Dear All,
How to run the ".sh" file through Adobe InDesign Javascript, I used the below coding:
//================== Code =============================//
var myFile = File("xxx/xxx/xxx/Test.sh");
var Exec = "sh" + " "+ "\""+myFile+"\"";
File(Exec).execute();
//================== End =========================//
the above coding is not working, I checked before without "sh" also, It is not working.
Please anyone can give me the solutions & suggestion, and I will appreciate.
Thanks & Regards
T.R.Harihara SudhaN.,Dear Hawkinson,
Many thanks for this quick reply, I'm really very happy, but unfortunately the script is return the "Permission denied" value.
I used the below code, Please kindly change if anything is wrong.
//====================== Script Source =====================//
var myFile ="/Applications/MacXinPro/IDMLExportparse.sh";
shell(myFile);
function shell(cmd) {
var
rv,
call ='do shell script "'+ cmd.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"';
try {
rv = app.doScript(call,ScriptLanguage.APPLESCRIPT_LANGUAGE);
} catch(e0) {
rv = e0+"\n"+(rv?"":rv);
return rv;
//====================== End : Script Source =====================//
//=========== Output ================//
Execution finished. Result: Error: sh: /Applications/MacXinPro/IDMLExportparse.sh: Permission denied
undefined.
Please kindly help me...
Thanks & Regards
T.R.Harihara SudhaN -
How to create a .java file through a j2me program?
I am trying to develop a small application in j2me which needs dynamic creation of a .class file. For this purpose I tried to create .java file through my j2me code, but i could not do that..I want to know whether a java file can be created on a mobile phone or not..
I would be grateful to you on your help in this regard.....develop a program xyz.java using j2me which performs the following functionalities:
1.create a file called abc.java
2.extract its class file...For +1+ ie to create a file (any file, no matter java or not) from j2me, device need to support File Connection specified in [jsr 75|http://www.jcp.org/en/jsr/detail?id=75]. If you're interested, learn the jsr API on how to create and manage needed file.
For +2+ described as extract its class file one needs to have java compiler (javac) on device. *) If you're interested, ask for more details at [Java Compiler forum|http://forums.sun.com/forum.jspa?forumID=7]. Also, if the class file is for CLDC then javac needs to support "JDK 1.3-compliant" compilation. To create CLDC classes on device, one also needs to have a preverifier tool. Check this at Java Compiler forum if needed.
Good luck - I think you'll need a lot of it...
*) javac on device -- it should not only be present but also provide a j2me API allowing to invoke it for particular java file with needed options. Same applies to preverifier tool. -
How To Access a jar file present outside the war file through a jnlp
Aoa
I m new to this forum
I m having problem with my jnlp file
i want to know is there any way to access a jar file through jnlp.The problem is that my jnlp file is present in the war file
and i want to know how to acess a jar file through this jnlp.The scenerio is as below
I m using ear file on jboss.Its hirerchy is as
-PAN-war.war
-launch.jnlp
-PAN-app-client.jar
my jnlp file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="PAN/launch.jnlp">
<information>
<title>PanEmirates</title>
<vendor>M Fazal Ur Rehman</vendor>
<description>PanEmirates</description>
<description kind="short">PanEmirates</description>
<homepage href=""/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+"/>
<jar href="PAN-app-client.jar" download="eager"/>
<jar href="lib/javafxrt.jar" main="true" download="eager" />
<jar href="lib/Filters.jar" download="eager"/>
<jar href="lib/javafx-netbeans-fxuserlib.jar" download="eager"/>
<jar href="lib/swing-layout-1.0.3.jar" download="eager"/>
</resources>
<application-desc main-class="net.java.javafx.FXShell">
<argument>pan.Main</argument>
</application-desc>
</jnlp>
when i run launch.jnlp file it says unable to download resource http://localhost:8080/PAN/PAN-app-client.jar
how to access this jar file
Any help or comment would be highly appreciated
Regards
M Fazal Ur RehmanExcellent question. I don't see any client-jar in your EAR file structure. So I am assuming you are writing a separate client application which will talk to the ejbs deployed as part of this EAR. You need to do the following:
Write another EAR file with the following structure:
ear:
META-INF/application.xml
util.jar
client.jar
client.jar should have a META-INF/MANIFEST.MF and that should contain Class-Path:util.jar and value for Main-Class attribute.
Now deploy this new ear to your application server and execute it using Application Client Container that comes with your app server.
If you don't want to write another EAR file, then bundle th client.jar in your original EAR file.
Points to note are:
you have to repackage util.jar again inside this ear file.
For portability reason, you should use Class-Path manifest entry in client.jar. Refer to http://java.sun.com/j2ee/verified/packaging.html and J2EE platform spec section #8.2.
Hope this helps,
Sahoo
Maybe you are looking for
-
How to pass a presentation variable to a stored procedure?
Hi All, We have a complex security model to emulate. In order to achieve that, we need to find a way for OBI to run and pass parameter to a stored procedure (SP). "APlus_BI_EmplName2" is the name of the stored procedure. This SP requires a param and
-
Steps to create customized Master data infoobjects in BI 7
Hi all, Can anyone please send the detailed steps to create customized master data infoobject in BI7,and also the data is to be extracted from two different datasources from two different source systems. Regards, G.Monica Roja Flora.
-
I keep getting this sandbox violation when I try and stream this video using NetStream and NetConnect. I'm getting the path from an XML file. If i just pop the path into an FLVPlayback component, it works just fine. Any Ideas? Edited to hide IP.
-
Having Refresh problems with one machine
Does anyone know what this would be. When I observe computers, one machine on the local network does not refresh, like all the others. You can really see the differenc in refresh between the other machines and this one. This one seems to stand still.
-
Trying to get my mac to recognise my windows computers in my wireless net.
i understand the method to do this, but am unsure how to write the reccomended url:- smb://?dnsname?/?sharename smb://?/?ipaddress?/?sharename? just what DO i write in the areas question marked?