Results 1 to 7 of 7
Thread: applet won't run in browser...
- 10-16-2008, 02:41 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 38
- Rep Power
- 0
applet won't run in browser...
hey, ive maid a simple test-applet in eclipse. It will run in eclipse, but if i export to a jar file and put it in my site directory it wont run; the java console gives a
-class not found exception- ?
here is the code and som more info, please help me...
<code>
package testPackage;
import java.applet.Applet;
import java.awt.*;
import java.awt.Graphics;
import java.awt.event.*;
import javax.swing.*;
public class TestApplet extends JApplet implements ActionListener {
JButton btn = new JButton("test");
JTextField jtf = new JTextField(10);
public void init() {
JPanel pnl = new JPanel();
btn.addActionListener(this);
pnl.add(btn);
pnl.add(jtf);
getContentPane().add(pnl);
}
public void actionPerformed(ActionEvent e){
if (e.getSource() == btn){
jtf.setText("this is a test!");
}
}
}
</code>
html code;
<code>
<APPLET CODE="TestApplet.jar" WIDTH="400" HEIGHT="200">
</APPLET>
</code>
- 10-16-2008, 02:46 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Why are you run the jar file in the applet. Run the class file and see.
- 10-16-2008, 04:59 PM #3
Member
- Join Date
- Sep 2008
- Posts
- 38
- Rep Power
- 0
<code>
<APPLET CODE="TestApplet.class" archive="TestApplet.jar" WIDTH="400" HEIGHT="200">
</APPLET>
</code>
there is still a classNotFoundException in java console:
what should the manifest file contain?, iv got an error with that to...
- 10-16-2008, 06:15 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Before run the applet check that class file is contain in the same location where your applet(html file) is located. manifest contain initial details to run the code, like main class name and so on.
- 10-16-2008, 10:54 PM #5
Can you copy and paste the FULL text of the error message?classNotFoundException in java console:
The message will say what class is NOT FOUND. THAT is VERY important.
I don't think the browser uses the manifest file for applets.
Look in the TestApplet.jar file to see if the missing class is there and has the correct path. Rename the .jar to .zip on Windows will allow you to easily view the jar file contents.
- 10-17-2008, 12:39 PM #6
Member
- Join Date
- Sep 2008
- Posts
- 38
- Rep Power
- 0
fixed it... i changed the content of the jar file and accordingly the html code and it works!!
thx very much for the help!!
- 10-17-2008, 06:24 PM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Please mark the thread solved, it's really helpful to all other members.
Similar Threads
-
Browser
By Jessie Madman in forum AWT / SwingReplies: 20Last Post: 02-17-2009, 01:56 PM -
Browser help
By MarkWilson in forum Advanced JavaReplies: 5Last Post: 09-20-2008, 11:20 AM -
Need Help! swt/Browser
By sealyu in forum SWT / JFaceReplies: 4Last Post: 07-09-2008, 08:16 PM -
how to get url from browser
By srinivas reddy in forum New To JavaReplies: 0Last Post: 02-08-2008, 07:46 AM -
Applet, To center text and To open I engage in a dialog in an Applet
By Marcus in forum Java AppletsReplies: 4Last Post: 06-08-2007, 06:15 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks