Applet not runing in Browser,although it runs in appletviewer.

Hello! I have created an applet which connects to an Oracle Database executes some queries and after some processing on the data selected it returns the results. When i run the applet using appletviewer everything works fine.(appletviewer -J-Djava.security.policy=C:\folder\mypolicy.java.policy C:\folder\applet2.html is the command i used).
The code of the HTML file i used is:
<html>
<head>
</head>
<body>
<applet code=applet2 archive=applet2.jar width=600 height=600>
</applet>
</body>
</html>
However when i run the html page(Mozilla Firefox) i get a white page with a frame where Java starts to load and then nothing happens. The frame remains white and i don't see the results that i see when i use appletviewer. I really don't know what is wrong and i would appreciate any answers cause i am new to this.
Thanx in advance...
Edited by: lefos987 on May 26, 2009 2:03 PM

lefos987 wrote:
appletviewer -J-Djava.security.policy=C:\folder\mypolicy.java.policy C:\folder\applet2.htmlWhen you run it via a browser, how do you propose to get the browser to acknowledge the custom security policy? You can't pass command line arguments to it.
However when i run the html page(Mozilla Firefox) i get a white page with a frame where Java starts to load and then nothing happens.It likely threw an exception, which you can get the detail of via the browser if you look for something like "Show Java Console".
Another note: The applet viewer runs in a different security model than browsers do, so if your applet is trying to access resources on the client machine, the browser isn't going to let that happen. In this case, probably it shouldn't be an applet in the first place.

Similar Messages

  • Applet not viewable in browser

    Hi
    applet not viewable in browser any website that uses java code seems not to run on my browser though it runs normally well on my friends computer. The browser shows a screen area in grey colour with an error message like "Exception: java.lang.ClassNotFoundException:GUIDemo.class" (im using Win NT4 and IE 5.5) checked the tools/internet options/advanced seettings the browser support is enabled. tried installing the newer version of JRE still not working ..Please guide about any settings that need to be modified or how can i fix this problem ..
    Regards
    anant
    [email protected]

    Hi
    Just a thought, but what broswer are you and your friend using? Are they different by any chance?
    There is an inconsistency between browsers and java, and unfortunately it can result in the error you saw.
    Basically, bog standard Internet Explorer uses its own JVM, whereas Netscape, Mozilla, Opera etc tend to use the java plug-in. To make matters worse, if you install the plug-in on a machine that has Internet Explorer installed, it over-rules the Microsoft version to make itself the default (but this can be undone by looking in the Options menu for Java-plugin and un-ticking the box). Give that a try first.
    Another cause that I have encountered was when using NT on a network, which had been configured not to accept Java Applets at all! Are you on such a network, or stand alone?
    Hope that helps.

  • Applet not working in browser, works with appletviewer

    Hi,
    I'm trying to use an Applet program from the tutorials which keeps on displaying time in the HTML page:
    import java.awt.Graphics;
    import java.util.*;
    import java.text.DateFormat;
    import java.applet.Applet;
    public class home_page extends Applet implements Runnable {
        private Thread clockThread = null;
        public void init()
        public void start() {
            if (clockThread == null) {
                clockThread = new Thread(this, "Clock");
                clockThread.start();
        public void run() {
            Thread myThread = Thread.currentThread();
            while (clockThread == myThread) {
                repaint();
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e){
                // the VM doesn't want us to sleep anymore,
                // so get back to work
        public void paint(Graphics g) {
            // get the time and convert it to a date
            Calendar cal = Calendar.getInstance();
            Date date = cal.getTime();
            // format it and display it
            DateFormat dateFormatter = DateFormat.getTimeInstance();
            g.drawString(dateFormatter.format(date), 5, 20);
        // overrides Applet's stop method, not Thread's
        public void stop() {
            clockThread = null;
    }When i use this program in the browser, i cannot see the clock but i'm able to see only a gray box. I'm using the applet tag within the HTML page.
    I can see the same compiled applet running successfully with appletviewer program.
    Please help me out of this predicament.
    -Manish

    I have recently had the same problem, after lots of searching, I found that only Java 1.1 is supported by browsers, leaving out everything else including swing. So if you cant play the applet through your browser you need to download the appropriate patch i think about 5mbs.
    You should find one at java.sun.com/getjava/download.html
    Mine worked fine afterwards

  • Applet - not rendering n Browser - Mozilla / IE - Help

    Hi,
    I have following code in AnotherHello.html in
    <html>
    <body>
    <applet code="AnotherHello.class" width="300" height="150"></applet>
    </body>
    </html>and the following in AnotherHello.java
    import java.awt.*;
    import java.applet.Applet;
    class  AnotherHello extends Applet
         public void paint(Graphics gr)     
              setBackground(Color.lightGray);
              gr.drawString("Hello", (300/2 - 40/2), (150/2 + 40/2));
    }When I run it using Mozilla or IE it only shows the HTML code in the browser, it does not get me the applet on to the screen. Could somebody help me in figuring out the problem.
    Thanks in advance.

    I have only these two browsers so dont know about
    other browsers.
    No it does not run in applet viewer also.
    I have the class file compiled in the same directory
    as in the java and the html file.
    I am able to see applets from various websites in my
    mozilla browser, which would mean that applet is
    enabled.
    I am not sure what could be the problem.
    Please do let me know.Sounds like it should run then. Maybe it is, but what it's drawing is "invisible" - what about removing that setBackground call, or set it to a different color. If you get a different result, then it is running.

  • Applet not showing in browser OR appletviewer window not appearing

    hi
    1. I have small java code - hello.java
    import java.awt.Graphics;
    public class hello extends java.applet.Applet
    public void paint(Graphics g)
    g.drawString("Hello java...................",600,300);
    which correctly compiled
    2. then I wrote an html file - hello.htm
    <HTML>
    <HEAD>
    <TITLE>HELLO</TITLE>
    </HEAD>
    <BODY>
    <appllet code="hello.class" width=400 height=400>hello not supported
    </appllet>
    </BODY>
    </HTML>
    3. but F:\javacode>appletviewer hello.htm not showing appletviwer window
    command prompt move to F:\javacode>
    4. opend the hello.htm through browser, "hello not supported " appearing instead of applet
    5. both files in same folder
    6. I am using IE8 & firefox (XP sp2)
    wh

    Quite apart from which a String drawn at [600, 300] wouldn't be visible in an Applet of width 400.
    db
    edit
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    Edited by: DarrylBurke

  • Applet not opening in browser  Help needed

    Hi experts,
    I have Java installed in my machine in the path C:\Program Files\Java
    While trying to open the link http://www.radinks.com/upload/applet.php in browser, I am being asked to install the missing plugin and that plugin is java.
    I do not know why this happens and I am stuck with this problem for sometime.
    Any help in this regard will be well appreciated with dukes.
    Thanks in advance,
    Kind Regards,
    Anees

    faheemhameed wrote:
    I have the same issue. But this is on Internet Explorer 8. Firefox is fine.Given the [web page does not validate|http://validator.w3.org/check?uri=http%3A%2F%2Fwww.radinks.com%2Fupload%2Fapplet.php&charset=(detect+automatically)&doctype=Inline&group=0] *(<- link),* I am not surprised it fails in some browsers while working in others. Checking the source of the page itself, I notice the applet is embedded in the page using an OBJECT element only, and that possibly also explains why it works in some browsers but not others.
    The best bet of the author of the web page is to defer writing the applet element to the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit] *(<- link)* that is provided by Sun.
    Unfortunately there is little that you can do about it, unless you want to attempt creating a page to load off your hard disk, that is valid and workable for IE. I cannot guarantee it will work, but try this variant..
    The altered web page, which can be tested at [http://pscode.org/test/radinks/applet.html].
    <html>
    <body>
    <applet
      code="com.radinks.dnd.DNDAppletPlus"
      archive="dndplus.jar"
      codebase="http://www.radinks.com/upload/"
      width= "290"
      height= "290"
      alt="Java is recognised, but disabled!">
        <param name="url" value = "http://67.131.250.110/upload.php">
        <param name="message" value="http://www.radinks.com/upload/init.html">
        <param name="name" value="Rad Upload Plus">
        <param name="max_upload" value="10000">
        <param name="encode_path" value="yes">
        <param name="translate_path" value="yes">
        <param name="full_path" value="yes">
    This browser does not recognise the Java APPLET element.  Get Java from www.java.com.
    </applet>
    </body>
    </html>

  • Applet not showing on browser even if its loaded

    I have created an applet which has some textfields and buttons.
    But when i want to see the applet in browser , it says it has been loaded but shows nothing. i have used swing for applet creation.
    help me out of this.

    What browser? What HTML code?
    Email me and I'll send you an article I've written on this subject. It is NOT as simple as it was 10 years ago.
    You'll need to use <APPLET> for macintosh, <EMBED> for MSIE and <OBJECT> for Netscape/Mozilla/Firefox/Opera. Then you'll need to understand 'code=' (see my reply to CleopatraL).

  • Applet not refreshing in browser

    I wrote a HelloWorld applet and viewing it through internet explorer. when i modify the code, compile it, then it replaces the original .class file, but when i refresh the browser, it loads the original applet. when i delete the .class file from the directory, the applet still shows up on the browser after i refresh it. whats going on? and how do i update the applet.

    you hafta CLOSE the browser and then re-open it so the VM sarts up again

  • Applet not showing in browser/only getting a grey box

    Hell to all....
    I am using a trial version of MS J++ and every time i execute to the browser i dont see my output all i get is a lil grey box on left side with header rules (<hr> tage in HTML) surounding the box. Can anyone help me out???
    if you need my code i will post it.
    Thanks in advance!

    OK ABUSE, check this out
    this is what i'm trying to do....The boss just wants me to connect to our database...and that's it....all i want to do is to see if i can connect to our database....so all the code is suspose to do is say database connected if it did and if it didn't then it should say connection failure...here is the code once again this is the code and that's it....
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.applet.Applet;
    public class Test extends Applet
    public static final String DB_URL = "jdbc:microsoft:sqlserver://<IP HOST>";
    private Connection conn;
    public void init(){
         try {
              DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver() );
              //Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
              this.conn = DriverManager.getConnection(DB_URL, "user", "pass");
              Statement stmt = conn.createStatement();
         catch (SQLException e){
              System.out.println("Cannot open database connection: " + e.getMessage());
         System.out.println("Connected to database");
    hope you understand what i'm trying to do....

  • Applet Not Working in Browser

    I built a java applet that works fine in the applet viewer, but just appears as a gray screen in a web browser. In the status bar of the web browser, it says that the applet has been started. The only possible cause of this that I can think of is a failure to connect to the internet. The program should appear like that if it fails to connect to the internet when it first starts. If this is the problem, please see my other post about making that work.
    http://forum.java.sun.com/thread.jsp?forum=31&thread=449444&tstart=0&trange=15

    1) What Browser?
    2) What is you code?
    1) If it is Internet Explorer, the problem would be an outdated JVM. MS JVM only supports up to Java 1.1.8 so you would have to rework your Applet to fit with just those classes/methods present at that time (ie no Swing, and check the APIs to make sure that the since version isn't past 1.1.
    If you are using other browsers, the old JVM may be a problem as well. It should be easy enough to install the latest one.
    2) Start out with something simple, like a hello world. Get that to work, then worry about the more complicated stuff.

  • Database applet not working in browser

    I am working on windows 2000 server. I have an applet that connects to a ms access database.Everything works in appletviewer. When i try to view the applet in ie i get the following error:
    Error: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    null
    Error: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    null
    access denied (java.lang.RuntimePermission accessClassInPackage.sun.jdbc.odbc)
    Basically i am trying to serve the applet on IIS. When I try to access the html page from
    a different machine, the applet loads and looks good except fails to connect with the database and display
    data.
    Any help will be highly appreciated.
    fnjoel

    You are not allowed to access Databases directly form an applet
    This is a security issue in Java Applets.

  • Java applet not runing in Internet Explorer

    I have HTML page with following code.
    <html>
    <body>
    <applet code="RootApplet.class" width=200 height=200>
    </applet></div>
    </body>
    </html>
    when i open it in IE. it shows nothing. no applet appears. but if i open page using appleviewer. java apllet shows and page opened.

    faisal_Sharif wrote:
    I have HTML page with following code.
    <html>
    <body>
    <applet code="RootApplet.class" width=200 height=200>
    </applet></div>
    </body>
    </html>
    when i open it in IE. it shows nothing. no applet appears. but if i open page using appleviewer. java apllet shows and page opened.Install the appropriate plug-in for IE. If the Applet is written with JDK 1.5, you should install the Java 1.5 plug-in (or later).

  • Could not Show FF Browser although it have been started in System (showed in Task Manager)

    I was installing FF version 3.6 and worked. But one time, i restart my computer (windows 7 ultimate) so it not work. Even, i had tried to install new version 4.0, it not work too. I don't know how to resolve this problem. I was check my laptop. Firewall not block it and Antivirus (AVG Free) not too. So please help me check this problem. This happened is always when i double click or try to open it.
    Thank you

    I was installing FF version 3.6 and worked. But one time, i restart my computer (windows 7 ultimate) so it not work. Even, i had tried to install new version 4.0, it not work too. I don't know how to resolve this problem. I was check my laptop. Firewall not block it and Antivirus (AVG Free) not too. So please help me check this problem. This happened is always when i double click or try to open it.
    Thank you

  • Button not working in browser

    I am coding a video player in Netbeans 6.8. just find two problems:
    1. the browser button not working in browser when I run the project from Netbeans under "run in browser" mode. however under "standard execution" mode, everything is fine.
    2. can not run the jar file in the project's dist directory directly. in other word, I can not run the jar file outside of Netbeans.
    I appreciate any help. thanks.
    Main.fx:
    package gui;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.paint.Color.*;
    * @author Jethro
    var face=Face{};
    function run(){
        Stage{
            title: "player"
            resizable:false
            scene: Scene{
                width:800
                height:600
                fill:DARKBLUE
                content: [face]
    }Face.fx:
    package gui;
    import javafx.scene.CustomNode;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.control.Button;
    import javafx.scene.layout.VBox;
    import javafx.scene.media.Media;
    import javafx.scene.media.MediaPlayer;
    import javafx.scene.media.MediaError;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.media.MediaView;
    import javafx.scene.control.ProgressBar;
    * @author Jethro
    public class Face extends CustomNode {
        public var lbf=LBF{};
        public var enable=true;
        public var mark="play";
        public var sourceOfMedia:String;
        public def player=MediaPlayer {
            repeatCount:MediaPlayer.REPEAT_FOREVER
            onError:function(e:MediaError){
                var er=e.message;
         media : bind Media {
              source: sourceOfMedia
        public def view=MediaView {
                mediaPlayer:bind player
                preserveRatio: true                    
        public def bar=ProgressBar {
                height:10
                width:bind scene.width
                progress: bind
                    if(player.media !=null){
                        player.currentTime.toMillis()
                            /player.media.duration.toMillis();
                    }else{
                        0.0
        public var play=Button {      
            onMousePressed:function(e:MouseEvent){
                if(enable and player.media != null){
                            mark="pause"; println("playing...");                       
                            sourceOfMedia=lbf.uri;
                            player.play();
                            enable=false;
                }else{
                    mark="play";
                    player.pause();println("paused...");
                    enable=true;
         text: bind mark       
        public override function create(): Node {
            return Group {
                content: [
                    VBox{
                        content: [
                            lbf,
                            bar,
                            play,
                            view,
    }LBF.fx:
    package gui;
    import javafx.scene.CustomNode;
    import javafx.scene.Group;
    import javafx.scene.control.TextBox;
    import javafx.scene.layout.HBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    import javafx.scene.Node;
    import javafx.geometry.HPos;
    import javafx.geometry.VPos;
    import javafx.scene.control.Button;
    import javax.swing.JFileChooser;
    * @author Jethro
    public class LBF extends CustomNode{
        public var uri:String;
        public var whereis=Text {
            fill:Color.BLUE
         font : Font {
              size: 20
         x: 10, y: 30
         content: "location: "
        public var location=TextBox{
            text:"the song's location"
            columns:40
            selectOnFocus:true
        public var browser=Button {
         text: "Browser"
         action: function() {
                    var jfc=new JFileChooser();               
              jfc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                    var val = jfc.showOpenDialog(null);
                    if(val == JFileChooser.APPROVE_OPTION) {                   
                        location.text = jfc.getSelectedFile().getAbsolutePath();
                        uri=jfc.getSelectedFile().toURI().toString();
                        println(location.text);
        public var face=Group {
         content: [
              Rectangle {
                        x: 0, y: 0
                        width: 800, height: 50
                        fill: Color.SILVER
                     HBox{
                         width:800
                         height:50
                         hpos:HPos.CENTER
                         vpos:VPos.CENTER
                         spacing:5
                         content: [whereis,location,browser]
        public override function create():Node{
            return face;
    }

    thanks for your reply but I need more specific operation.
    maybe I am not very clear about the problem one. I mean when I run the code in standard mode, if I click the browse button, a window will pop out and I can choose a video file from my local harddisk. but if I run it in "web start execution" mode and "run in browser" mode. the browse button make no response when I click it.
    Edited by: Phoenix2006 on Feb 8, 2010 2:35 PM
    Edited by: Phoenix2006 on Feb 8, 2010 2:37 PM
    Edited by: Phoenix2006 on Feb 8, 2010 2:42 PM

  • Start:applet not initilaized error

    Hi friends,
    I'm getting Start:applet not initilaized error when i'm running a program...
    saved a notepad file as Testloan.java used javac Testloan.java and appletviewer Testloan.java to execute the applet here is my code...
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    <html>
    <applet code="Testloan.class" width=300 height=100>
    </applet>
    </html>
    public class Testloan extends Applet implements ActionListener
    TextField t1,t2,t3;
    Label lp,lr,lmp;
    Button b1,b2;
         public void init()
         lp=new Label("Principal");
         lr=new Label("Rate");
         lmp=new Label("Payment");
         add(lp);
         add(lr);
         add(lmp);
         t1=new TextField();
         add(t1);
         t2=new TextField();
         add(t2);
         t3=new TextField();
         add(t3);
         b1=new Button("submit");
         add(b1);
         b1=new Button("Exit");
         add(b2);
         b1.addActionListener(this);
    b2.addActionListener(this);
    public void start() {
    //win.setVisible(true);
    public void stop() {
    //win.setVisible(false);
    public static int months(int principal,double rate,int payment)
              Testloan tl=new Testloan();
              principal=Integer.parseInt(tl.t1.getText());
              rate=Double.parseDouble(tl.t2.getText());
              payment=Integer.parseInt(tl.t3.getText());
              int p=principal;
              double eRate = rate / 1200.0;
              int month =0,np=1;
                   while(np>0)
                   month = month + 1;
                   np= (int) (p*(1+eRate)-payment );
                   System.out.println(np+"/n");
                   p = np;
              return month;
    public void actionPerformed(ActionEvent e)
    String cmd = e.getActionCommand();
    }

    First, the code you posted was mangled by the forum formatting software. When you post code, select it and click the CODE button above the typing area, which will prevent that, and maintain your formatting.
    When you ran the appletviewer program from the cmd window, error information was posted to it by the java command. Did you look at it? It says that you have a NullPointerException at this line
    add(b2);because there's a typo in this line
    b1 = new Button("Exit");which should have assigned a value to b2, not b1
    Read and understand the error messages that java creates, they almost always point exactly at the problem and allow you to debug the cause.

Maybe you are looking for

  • New Development on my iphone from yelling!

    Okay so I posted a little bit ago the post on my iphone having to yell to callers can hear me. It seems that when I plug in my headphones people can hear me thru the headphones mic and when I unplug it callers tell me they hear a squealing noise and

  • How do I delete a second apple ID

    I have two Apple ID's how do I delete one of them, it keeps interfering with the Apple Store

  • IPAD mini - emails going to outbox for 2 weeks - I need to send them

    I have just spent three hours trying to pinpoint problem I have had with my iPAD mini for about two weeks - - 15 messages sitting there in outbox - - I get that smtp.verizon.net - which I understand is correct.  It does seem to be affected by any oth

  • Need help in Plsql for Oracle Reports

    Hi i need urgent requirement for this, Kindly guide me. Since i couldnt do. Main Table: For example: Conside this table: (Card_no, month and year are unique constraint) Card_No Name Amount_1 Amount _2 Total Month Year 1 Justin 50 1000 1050 Jan 2011 1

  • Using Apture with Iweb site or iweb blog

    Hi all I've just discovered apture- http://www.apture.com/ on the net and I'm really impressed with what it does. I'd like to use it on my site. I upload my site to mobile me. I s there a way to add the apture code into i web site which then allows m