Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Permission + Policy File + Java Applet

844235Sep 10 2011 — edited Sep 12 2011
Hi everyone,

I developped a small Java applet for testing purposes.
The aim of the applet is getting data from a MySql database and displayed it into a JLabel.
I use a MySql jdbc layer contained in a Jar file.

I tested the applet locally via Eclipse and it works fine.
Then, I packaged my ".class" files into a Jar file.
I uploaded the resulting Jar file to the server as well as the jdbc Jar file.

I tried to launch the applet located on the server from my web browser (IE9).
An error occured.
I analysed the results in the Java console.
The reason of the problem follows :
I miss a permission grant in my policy file.
The missing line is : permission java.util.PropertyPermission "file.encoding", "read";

For information, the policy file is located at : jre7|lib|security

I do no want to ask the users of my future applet to modify their policy file.
So, I am wondering if there is a way to consider a custom policy file when executing a Java applet.
The custom policy file would be located on the same server as the applet is.

Thanks in advance for your help.
This post has been answered by DrClap on Sep 12 2011
Jump to Answer

Comments

Frank Kulash

Hi,

You need to initialize suma, like you initialize.x:

DECLARE

    x    NUMBER (10) := 1;

    z    NUMBER;

    suma NUMBER      := 0;

BEGIN

    WHILE x <= 3

    LOOP

        z := (x * 2) + 4;

        suma := suma + z;

        x := x + 1;

    END LOOP;

    DBMS_OUTPUT.PUT_LINE (suma || ' = final suma');

END;

/

NULL plus anything is NULL, so if suma is NULL when you reach this statement

suma := suma + z;

then it will be NULL after executing that statement.

Also, you're going through the loop an extra time.  Since x starts at 0, yu're starting the loop when x is 0, 1, 2 and 3, and incrementing the sum for x as 1, 2, 3 and 4.

(I see Galo caught the same thing while I was revising this message.)

Galo Balda

Another thing is that you're doing 4 iterations since x starts with 0

Frank Kulash

Hi,

You can do this in pure SQL, too:

SELECT  SUM ((2 * LEVEL) + 4)  AS suma

FROM    dual

CONNECT BY  LEVEL  <= 3

;

1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 10 2011
Added on Sep 10 2011
16 comments
717 views