The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

solution

Posted by Atul Patel on April 29, 2001 at 9:07 AM

did you ever get a solution to this? I'm having the same problem.


> How can i fix this error..I NEED YOUR HELP!!
> This program run well on the appletviewer, but when I start Explorer, it returns an error message "HelloWorld can't be instantiated" on the state bar of Explorer and Jav Console Window shows this error message...
> ========= error=========
> java.lang.InstantiationException: HelloWorld

> at com/ms/applet/BrowserAppletFrame.newInstance (BrowserAppletFrame.java)<
> at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
> at com/ms/applet/AppletPanel.processSentEvent (AppletPanel.java)
> at com/ms/applet/AppletPanel.run (AppletPanel.java)
> at java/lang/Thread.run (Thread.java)

>
> This is my code..
> ====================================================
> import com.ms.security.*;
> import java.io.*;
> import java.net.*;
> import java.awt.*;
> import java.awt.event.*;
> import java.lang.*;
> import java.applet.*;

> public class HelloWorld extends Applet implements ActionListener{
> public native void playWaveFile();
> public native void displayHelloWorld();
> public native void returnHandle();

> static {System.loadLibrary("Hello");}

> private Panel pnlTotal;
> private Panel pnlOperator;
> private Panel pnltaShow;
> private TextArea taShow;
> private Button btnPlay;
> private Button btnRecord;

> public void init(){
> try{
> PolicyEngine.assertPermission(PermissionID.SYSTEM);
> }catch(Throwable cnfe){}

> pnlTotal = new Panel(new BorderLayout());
> pnlOperator = new Panel();
> pnltaShow = new Panel();

> btnPlay = new Button("Play");
> btnPlay.addActionListener(this);
> btnPlay.setEnabled(true);
> pnlOperator.add(btnPlay);

> btnRecord = new Button("Record");
> btnRecord.addActionListener(this);
> btnRecord.setEnabled(true);
> pnlOperator.add(btnRecord);

> taShow = new TextArea(13,39);
> pnltaShow.add(taShow);
> taShow.setEditable(false);

> add(pnlOperator, "South");
> add(pnltaShow, "Center");

> setSize(300, 300);
> setVisible(true);

> taShow.append("You can record and play using this program\n");
> }

> public void actionPerformed(ActionEvent event){
> String command = event.getActionCommand();

> if(command.equals("Play")){
> taShow.append("Start play...\n");
> playWaveFile();
> returnHandle();
> taShow.append("End play...\n");
> }else if(command.equals("Record")){
> taShow.append("Start record...\n");
> displayHelloWorld();
> returnHandle();
> taShow.append("End record...\n");
> }
> }
> public void start(){}
> public void stop(){}
> public void destroy(){}
> }






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us