Archive

Archive for August, 2009

How to let an Applet Read and Write file?

August 31, 2009 Leave a comment

How do I let an applet read a file?
Applets loaded into a Java-enabled browser can’t read files.

Sun’s appletviewer allows applets to read files that are named on the access control list for reading. The access control list for reading is null by default, in the JDK. You can allow applets to read directories or files by naming them in the acl.read property in your ~/.hotjava/properties file.

Note: The “~” (tilde) symbol is used on UNIX systems to refer to your home directory. If you install a web browser on your F:\ drive on your PC, and create a top-level directory named .hotjava, then your properties file is found in F:\.hotjava\properties.

For example, to allow any files in the directory home/me to be read by applets loaded into the appletviewer, add this line to your ~/.hotjava/properties file.

acl.read=/home/me

You can specify one file to be read: acl.read=/home/me/somedir/somefile

Use “:” to separate entries: acl.read=/home/foo:/home/me/somedir/somefile

Allowing an applet to read a directory means that it can read all the files in that directory, including any files in any subdirectories that might be hanging off that directory.

How do I let an applet write a file?

Applets loaded into a Java-enabled browser can’t write files.

Sun’s appletviewer allows applets to write files that are named on the access control list for writing. The access control list for writing is empty by default.

You can allow applets to write to your /tmp directory by setting the acl.write property in your ~/.hotjava/properties file: acl.write=/tmp

You can allow applets to write to a particular file by naming it explicitly:
acl.write=/home/me/somedir/somefile

Use : to separate entries: acl.write=/tmp:/home/me/somedir/somefile

Bear in mind that if you open up your file system for writing by applets, there is no way to limit the amount of disk space an applet might use.

Categories: Java Development

Java Applets – Can it read and write files?

August 29, 2009 Leave a comment

In Java-enabled browsers, untrusted applets cannot read or write files at all. By default, downloaded applets are considered untrusted. There are two ways for an applet to be considered trusted:

The applet is installed on the local hard disk, in a directory on the CLASSPATH used by the program that you are using to run the applet. Usually, this is a Java-enabled browser, but it could be the appletviewer, or other Java programs that know how to load applets.

The applet is signed by an identity marked as trusted in your identity database. For more information on signed applets, refer to an example of using signed applets, and to a short description on using javakey.

Sun’s appletviewer allows applets to read files that reside in directories on the access control lists.

If the file is not on the client’s access control list, then applets cannot access the file in any way. Specifically, applets cannot

  • check for the existence of the file
  • read the file
  • write the file
  • rename the file
  • create a directory on the client file system
  • list the files in this file (as if it were a directory)
  • check the file’s type
  • check the timestamp when the file was last modified
  • check the file’s size

What are Java Applets Prevented from Doing?

August 28, 2009 Leave a comment

Java Applets, one of the GUI enrich feature of Java supports many functionality. Although Java Applets are restricted to some boundaries. It is prevented from doing some functions which are described here.

In general, applets loaded over the net are prevented from reading and writing files on the client file system, and from making network connections except to the originating host.

In addition, applets loaded over the net are prevented from starting other programs on the client. Applets loaded over the net are also not allowed to load libraries, or to define native method calls. If an applet could define native method calls, that would give the applet direct access to the underlying computer.

There are other specific capabilities denied to applets loaded over the net, but most of the applet security policy is described by those two paragraphs above. Read on for the gory details.

Concept behind Development of Java

August 21, 2009 1 comment
  • It should be “Architecture Neutral and Portable” in other words Platform Independent
  • It should be “High Performance with wide functionality”
  • It should be “Simple to use & interpret and Object Oriented”
  • It should be “Robust and Secure”
  • It should be “Multithreaded and Dynamic”

Explanation of Terms in Detail:

Object Oriented:

Object Oriented Programming language, widely known as OOP gives emphasis to the object rather than procedure call. OOP language use to consist features such as information hiding, encapsulation, polymorphism, data abstraction, modularity and inheritance. First major development towards OOP was C++. Before the development of C++, languages like C which is a POP (Procedure Oriented Programming) language. Then Development of Java happened which was a major step towards high level application development.

Architecture Neutral:

This term also refers to the Platform Independent. It means, Java generates the byte code after compilation which is interpreted by induvidual platform’s JVM. As byte code is not restricted to any platform, Java developed application can be run on any platform with slight modifications. There is also no restriction on the hardware platform a programmer uses.

Portable:

Its meaning is also very much same as platform independent. A software that can be run in different hardware configuration is called a portable programming language. Considering Wikipedia’s words a portable application means ” A software that can easily be ported to multiple platforms”.

Robust:

Robustness is the quality of being able to withstand stresses, pressures, or changes in procedure or circumstance. A system, organism or design may be said to be “robust” if it is capable of coping well with variations (sometimes unpredictable variations) in its operating environment with minimal damage, alteration or loss of functionality.

Welcome to Java Software Development WordPress Blog!

August 21, 2009 Leave a comment

Welcome to a Blog dedicated to the information and the updates on different Java technology and the Application Development on it.

Also this blog will provide you the insight scoop of what skills of technology a developer have to build a project on any Java technology.

You can find here useful and only useful links all across the Blog regarding latest news on Java software development and the things a developer should take care about.

Follow

Get every new post delivered to your Inbox.