Working with files in applets
Can I access files in applet? I tried to open a file in the 'init()' method, read from it and write to it. A SecurityException was thrown. What is that for?
Can I access files in applet? I tried to open a file
in the 'init()' method, read from it and write to it.
A SecurityException was thrown. What is that for?java has very strong security regarding to applet. you might want to use a Frame and your problem should be solved. This is done to prevent any applet from the net to write some virus to your system.
bol,
npaila
Similar Messages
-
I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it shows in LR under folders as the F drive and the little green light is on, but LR is showing only the first 6 files and not the remaining 200 or so. How do I expand the F folder to expose all files?
I worked with files in LR that were originally on my C drive, then were moved to an external HD for storage. I now want to do some more work on those files (which have the same file name as on the C drive). I plugged the drive into my computer and it shows in LR under folders as the F drive and the little green light is on, but LR is showing only the first 6 files and not the remaining 200 or so. How do I expand the F folder to expose all files?
-
How to work with files in folders on Application/Presentation Server
Hi,
I am working on interface program in which files are populated in folders in application/presentation server in the format 'ABCsy-datumsy-uzeit.txt'(e.g.ABC20051022161450.txt,ABC20051022161455.txt ) in directory c:\temp.
I want to sort all these files and read in sorted manner.
can anybody help me out in this.
waiting for reply.
thanks & regards,
NitinHi,
This logic will work for files on presentation server,
DATA: l_count TYPE i,
l_filename TYPE string,
t_files TYPE string OCCURS 0 WITH HEADER LINE,
BEGIN OF t_files_sorted OCCURS 0,
file_prefix(3),
file_date LIKE sy-datum,
file_time LIKE sy-uzeit,
file_extension(4),
END OF t_files_sorted,
t_text TYPE TABLE OF w3html.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = 'C:\Temp'
FILTER = '*.txt'
files_only = 'X'
DIRECTORIES_ONLY =
CHANGING
file_table = t_files[]
count = l_count
EXCEPTIONS
cntl_error = 1
directory_list_files_failed = 2
wrong_parameter = 3
error_no_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT t_files.
t_files_sorted = t_files.
APPEND t_files_sorted.
ENDLOOP.
SORT t_files_sorted BY file_date file_time.
LOOP AT t_files_sorted.
CONCATENATE 'C:\Temp\' t_files_sorted INTO l_filename.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
IMPORTING
FILELENGTH =
HEADER =
changing
data_tab = t_text[]
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
others = 17.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*****Your processing here..
ENDLOOP.
Also, use the FM that MAX has if you have to work with files on application server by replacing code in the above logic at appropriate places, like replace
cl_gui_frontend_services=>directory_list_files
with the corresponding fm
and replace cl_gui_frontend_services=>gui_upload
with OPEN DATASET...
CLOSE DATASET...
logic.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni -
How to work with file system in linux within a JSF app?
I use this line in my backing bean to log some events:
FileHandler fhxml = new FileHandler("../webapps/MyWebApp/Log/MyWebAppLog.xml", append);
fhxml.setFormatter(new XMLFormatter());That works fine in windows but when I deploy it in my Tomcat 6 in linux It doesn't work. How can I work with file system in linux?You should never use relative paths to access the filesystem. The path would be relative to the current working directory which is not per se the same in all environments. To convert a relative web path to an absolute file system path, you need ServletContext#getRealPath(). Use this absolute file system path in the java.io stuff. In a JSF application on top of Servlet API you can get the underlying ServletContext by ExternalContext#getContext().
Alternatively, if the file is located in one of the default paths of the classpath or if its path is added to the classpath, you can also just use ExternalContext#getResource() or even #getResourceAsStream() using just the file name. -
Cannot print "working with files and folders htm
When I try to print "Working with files-and-folders" from a Google search, it only prints part of it. I have changed my destination folder to no avail. Thank you or any help, Jack Menendez
What's the best method for moving all my nonsystem related stuff over to this new driveIan has provided you with the best solution, SuperDuper.
But if you have a 250 GB external, you really ought to clone your entire system,(only about 3 GB) so you have a backup.
I keep mine with a complete clone of my internal, that way it is easy to boot from the external and run utilities like Disk Utility, TechToolPro, DiskWarrior, etc. on the internal and vice versa.
If you run into a problem with say Preferences and don't know which one is the troublemaker, just trash the whole pref folder and use the good one from the clone. Font problem, same deal. And, if diaster ever strikes, you can just boot up from your external and keep right on working - fix the internal when you have time.
That's my 2 cents anyway
-mj
[email protected] -
Hello!
Can anyone help me. How can I API in Java Technology for files to find ?don't uite understand your question.
here's the location of java API for File class, for working with File and Directory..
http://java.sun.com/j2se/1.3/docs/api/java/io/File.html
for reading and writing..you may want to look at th eio package for classes such as
Reader, FileReader, BufferedReader, Writer, FileWriter, BufferedWriter
here's java API
http://java.sun.com/j2se/1.4.2/docs/api/ -
Managing spaces when working with files
Hi, how can I work with files on windows on paths thats have blank spaces like "Documents and Settings", I used getResource().getFile() and writting the path but it always fails!
The FileOutputStream always thorws the exception FIleNotFoundException.
I tried the path with blank spaces and tried with %20 but always is the same.Are you saying that OutputStream os = new FileOutputStream("C:/Documents
and
Settings/AAD/workspace/MobileServer/bin/Configuracion/
conexiones.omt");throws an exception? If so, what exception?Exactly it throws an Exception.
java.io.FileNotFoundException: C:\Documents and Settings\AAD\workspace\MobileServer\bin\server\Configuracion\conexiones.omt (El sistema no puede hallar la ruta especificada)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at server.tcp.GestionTCP.guardar(GestionTCP.java:118)
at server.tcp.GestionTCP.mouseReleased(GestionTCP.java:89)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121) -
Will the current plugins for Sigma DP1/2 RAW files work with files from the DP1/2 Merrill cameras? And if not, is Adobe developing plugins for these cameras?
Not sure what plugins you mean, Hornet - Lr doesn't rely on plugins to read new cameras.
If you mean the Adobe Camera Raw (ACR) plugin - that's for Photoshop, not Lightroom. Lr has the same functionality as ACR, but it's hard-coded into the program, so if you're looking for support for a new camera, you need to wait for a new version of Lr.
And nobody here can say when Lr support for a given camera will happen.
Hopefully someone with a Merrill will be able to chime in about whether its files work with the current Lr. -
Freeze up after working with files copied to DVD. A105-4274 Satillite
When working with files copied to a DVD, when ejecting my computer locks up. Have to turn it off manually and restart.
Can use anyother type of DVD, and this does not happen. Only useing DVD with files written to it. This only happens when i work with the files and then eject the DVD. Please I need help
Solved!
Go to Solution.ebonykaneezer wrote:
When working with files copied to a DVD, when ejecting my computer locks up. Have to turn it off manually and restart.
Can use anyother type of DVD, and this does not happen. Only useing DVD with files written to it. This only happens when i work with the files and then eject the DVD. Please I need help
I'm guessing that you are just pressing the eject button on the drive. Don't do that.
Quit the application that you are using to work with the files. Then open Windows Explorer, right-click the CD/DVD drive and click on 'Eject'. -
Applet showDocument work with file protocol?
Hi,
I have a signed applet (using signtool and Thawte certification) with full permission. Now I want to display a local text file from the browser. So here is the code I am using:
try
//test file protocol
applet.getAppletContext().showDocument(new URL("file:///c:/test.txt"),"_blank");
//test http protocol
applet.getAppletContext().showDocument(new URL("http://java.sun.com"),"_blank");
catch(Exception e)
e.printStackTrace();
But noting happens to display the file in IE or Netscape(win2k, IE 6 and netscape 7.1), not even an exception is thrown. The http page does open in a new browser. In IE I can set security/local intranet/sites to make file display work. But it's not a good idea to ask every client machine to change the browser settings to make this work.
Does anyone know why showDocument does not work for file protocol? Have anyone solve this problem?
Thanks a lot!Try this:
try
//test file protocol
applet.getAppletContext().showDocument(new URL("file:\\\\c:\\test.txt"),"_blank");
//test http protocol
applet.getAppletContext().showDocument(new URL("http://java.sun.com"),"_blank");
catch(Exception e)
e.printStackTrace();
It works for me... -
Working with files on mobile devices
Hi everybody,
at the moment we are running a Vibe 3.4 server which is used most of the time by normal pc clients with the users using the browser or the Vibe desktop client to connect. Now we are getting a tablet project using Vibe more via mobile access (Android based) . The Problem now is, I can do many things with my mobile Vibe access or the Vibe App but I havent figured out how to work with my files stored in Vibe while accessing them via a mobile device.
Is there any possibility to open and work with the files/attachments?
If no, is this a planned feature for the future?
Any help, hint or trick is is greatly appreciated
Regards,
Andreasastock,
It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.
Has your problem been resolved? If not, you might try one of the following options:
- Visit http://www.novell.com/support and search the knowledgebase and/or check all
the other self support options and support programs available.
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.novell.com)
Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.novell.com/faq.php
If this is a reply to a duplicate posting, please ignore and accept our apologies
and rest assured we will issue a stern reprimand to our posting bot.
Good luck!
Your Novell Forums Team
http://forums.novell.com -
LabView limitation : working with File 2 Go
Hi,
I'm acquiriring data in real time from several cards et high frequencies (102400 Hz).
The acquisition can last 10 hours and so the file can have size like 150 Go.
All labview file functions work with int32 to set offset, size of file... in byte.
How Can I do ?? (example : I have a 6 Go file : how can I know it's size with labview ???)
Eddy DUCHENE
12 F Chemin de Boutary
69300 CALUIRE ET CUIRE
[email protected]educhene wrote:
I'm using a loop with Read Vi to seek in the file. It works well, But When my file is greater than 2 GB, I got a memory error (mémoire insuffisante pour terminer l'opération) when I try to read for example 263000 singles data.
This error appears when I want to read my 263000 values (not when seeking).
I don't understand why, because it runs well with a file less than 2 Gb even if I want to read more values.
Please find attached the example vi. Choose a file and run it : if your file size is less than 2 Gb (but have enough datas (ex : file size 10 Mb), it's ok, but if you run it with a file size more than 2 Gb you have the memory error.
Help please ...
As has been mentioned if you go to http://www.openg.org you will find in the File function Toolkit a library Large File Access, which works only on Windows as it calls directly into the WinAPI. Unlike other responses who said that the 2GB limit is a limit of the OS, Windows is actually able to work with larger file offsets. But LabVIEW currently does not make use of this option. The OpenG Large File functions mimic the LabVIEW low level FileIO functions but use a double precision floating point for all offset related parameters due to the lack of int64 support in LabVIEW.
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Disappearing hard drive and sudden inability to work with files from my camera.
I was installing the photoshelter plugin and noticed my external hard drive was not displayed. I had to import the whole drive again. Now when I try to import from my cards I get the error that this version of LR cannot work with my camera files. It has been working with them for years so what's up?
It's a long shot, but if nothing more concrete is posted, as you had just installed Photoshelter, have you tried uninstalling it and seeing whether this makes a difference.
-
Help working with File() objects
Hi,i'm sorry for my not-so-perfect English.
I'm working with java.io.File object, to use and know the contents of a folder.
But if i try to use the function list() on a folder that is the first in my hard drive (For example: C:\Test on windows, or /usr on unix), and try to get the Parent...i receive null.
This is a regoular way,in my opinion; But i have a problem: i'm working at a Java File Manager, and i'd like to LIST all my hard driver present in my computer (ie. C:,D:, E:) but i don't really know how to do...!!
On UNIX, i can resolve this problem using a list() on /mnt folder, for mounted drive...but on Windows...how can i!?
Thanks for the answers...Hi,
Take a look at:
File.listRoots()
Kaj -
Working with frames and applets
Hi, I am writing an applet that recieves information from a sever. before the applet loads I display a frame that allows the user to select the information that is transfered across the net.
I block the applet from finishing until the okay button is clicked on the frame. However if I don't add my frame to the applet I can't manipulate the frame, and the frame doesn't recognize any mouse events
When i do add the frame to the applet, the checkboxes work and the button toggles, but the click doesn't do anything.
Finally the program works while using the applet viewer but it doesn't work across the net. Any information any one has would be greatly appreciated.here is the code of the frame that doesn't work
import java.awt.*;
import java.awt.event.*;
public class channelSelect extends Frame implements ActionListener
{/*This class alows the user to pick from a number of channels to be transfered
across an internet connection*/
private int channels = 8; //the total number of channels
private Checkbox[] checkbox = new Checkbox[channels]; //an array of checkboxes
private Button button1 = new Button(); //the button to signify the user has choosen the channels
private int[] c = new int[channels]; //an array to determine which checkboxes were checked
private boolean done = false; //a flag to tell the base class if the user is finished
public channelSelect()
try
jbInit();
catch(Exception e)
e.printStackTrace();
public int[] obtainChannels()
{//returns the array of choosen channels
return c;
public int isDone()
{//returns if the user is finsihed
if(done)
return 1;
else
return 0;
private void jbInit() throws Exception
{//sets the layout for the frame
this.setLayout(null);
this.setTitle("Select Channels");
for(int j = 0; j < channels; j++)
checkbox[j] = new Checkbox();
checkbox[0].setBackground(new java.awt.Color(0, 200, 250));
checkbox[0].setBounds(new Rectangle(64, 55, 198, 20));
checkbox[0].setLabel("sinwave");
checkbox[1].setBackground(new java.awt.Color(0, 200, 250));
checkbox[1].setBounds(new Rectangle(64, 133, 198, 20));
checkbox[1].setLabel("squarewave");
checkbox[2].setBackground(new java.awt.Color(0, 200, 250));
checkbox[2].setBounds(new Rectangle(64, 211, 142, 30));
checkbox[2].setLabel("coolant temp");
checkbox[3].setBackground(new java.awt.Color(0, 200, 250));
checkbox[3].setBounds(new Rectangle(64, 289, 198, 20));
checkbox[3].setLabel("No signal1");
checkbox[4].setBackground(new java.awt.Color(0, 200, 250));
checkbox[4].setBounds(new Rectangle(356, 55, 198, 20));
checkbox[4].setLabel("No signal2");
checkbox[5].setBackground(new java.awt.Color(0, 200, 250));
checkbox[5].setBounds(new Rectangle(356, 133, 198, 20));
checkbox[5].setLabel("No signal3");
checkbox[6].setBackground(new java.awt.Color(0, 200, 250));
checkbox[6].setBounds(new Rectangle(356, 211, 198, 20));
checkbox[6].setLabel("No signal4");
checkbox[7].setBackground(new java.awt.Color(0, 200, 250));
checkbox[7].setBounds(new Rectangle(356, 289, 198, 20));
checkbox[7].setLabel("No signal5");
this.setBackground(new java.awt.Color(0, 200, 250));
button1.setBounds(new Rectangle(235, 477, 98, 30));
button1.setLabel("OK");
button1.addActionListener(this);//new java.awt.event.ActionListener()
public void actionPerformed(ActionEvent e)
button1_actionPerformed(e);
*/ this.add(checkbox[0], null);
this.add(checkbox[5], null);
this.add(checkbox[6], null);
this.add(checkbox[1], null);
this.add(checkbox[7], null);
this.add(checkbox[2], null);
this.add(checkbox[3], null);
this.add(checkbox[4], null);
this.add(button1, null);
this.setSize(610,527);
this.setVisible(true);
this.toFront();
public void actionPerformed(ActionEvent e)
{//populates the array of choosen channels
Object source = e.getSource();
if(source == button1)
for(int i = 0; i < channels; i++)
if(checkbox.getState())
c[i] = 1;
else
c[i] = 0;
done = true;
and this is where i instantiate it and call some of it's methods.
/* Setup channel selections */
channel_select = new channelSelect();
while(channel_select.isDone() == 0)
{ //wait for the channel selection to occur
channels = channel_select.obtainChannels();
channel_select.dispose();
channel_select = null;
setChannels();
Maybe you are looking for
-
How to let the user define the colors for each plots in the graph (I use LabVIEW 7)?
How to let the user define the colors for each plots in the graph (I use LabVIEW 7)?
-
I can't get my 1G iPod Nano to sync properly. I've restored it twice and its still throwing errors. I get an error that reads ". . . there is not enough free space to hold all of the items in the selected playlists. Would you like to turn off podcast
-
Can you bring a smartform into ITS transactions PZ10 to view pay stubs
We are currently using integrated ITS, transactions PZ10 and PZ11 in our production portal to display pay statements in a PDF. The pay statements that are being displayed were developed with a sapscript. We are revamping our paystub and changing it
-
I have a 7th generation IPOD, I have downloaded APPLE ISTORE software and have downloaded 23 of my CD's. All of this is being done thru a Windows desk top. I can not get it to download automatically the CD's to my IPOD. Please advise
-
Reinstall osx mavericks & creative cloud
I am about to reinstall osx mavericks on my mac. Will creative cloud remember what extensions i have (paid or free) & any fonts i have synced? Also the sync feature i presume will keep all my preferences? Thanks in advance