Results 1 to 10 of 10
- 09-17-2008, 08:16 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 9
- Rep Power
- 0
[SOLVED]starting a Swing application from an applet
Hi,
I wrote an application in netbeans using the Swing Application Framework and now I would like to write an applet with a button starting this application. The problem is, that when I run this applet I get the following error:
here's the html file:Java Code:java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication
...and the applet code (the button is not yet here):Java Code:<APPLET codebase="classes" code="adminpanel/Admin.class" width=50 height=200> </APPLET>
Java Code:public class Admin extends JApplet{ private JButton guzik; @Override public void init(){ setLayout(new FlowLayout(FlowLayout.CENTER)); AdminPanelApp.launch(AdminPanelApp.class, null); }}Last edited by FakeRabbit; 09-21-2008 at 07:01 PM.
- 09-17-2008, 10:59 PM #2
type appletviewer: as the protocol
put it in the browser address bar where http normally goes
also, the slashes in the name path somehow are the same as the dots in filename, pathnames. Have not figured it out but it shows in the paths you are posting.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 09-18-2008, 12:08 AM #3
The JVM can't find that classorg/jdesktop/application/SingleFrameApplication
Where is the above reference class located? Probably in a jar file. Find that jar file, copy it to the folder with the HTML file and add archive=<jarfile> to the <APPLET tag
- 09-18-2008, 10:51 AM #4
Member
- Join Date
- Sep 2008
- Posts
- 9
- Rep Power
- 0
Thanks for the reply.
So I found the appframework-1.0.3.jar in dist/lib folder and copied it into the build folder, where my html is located. I edited the html file:
Still the same error I'm afraid.Java Code:<APPLET codebase="classes" code="adminpanel/Admin.class" ARCHIVE="appframework-1.0.3.jar" width=350 height=200></APPLET>
sorry, but I don't understand. What do I have to put in the addres bar and where do I type "appletviewer: as the protocol"?type appletviewer: as the protocol
put it in the browser address bar where http normally goes
- 09-18-2008, 02:12 PM #5
How are you loading the html into the browser? Directly by clicking on the html or via a server?
Can you post the full contents of the error message in the Java Console?
Whoops, just noticed the codebase= attribute. Try putting the jar file in that folder.Last edited by Norm; 09-18-2008 at 04:11 PM.
- 09-18-2008, 11:02 PM #6
Member
- Join Date
- Sep 2008
- Posts
- 9
- Rep Power
- 0
Wow that seems to be the solution :) But now I'm experiencing another problem:
My first guess was to put the AdminPanel.jar file (jar with my application from dist folder) in the same folder as the rest of them but it didn't work out. I also tried to put it in classes/adminpanel folder - same result :(Java Code:java.lang.NoClassDefFoundError: adminpanel/AdminPanelApp at adminpanel.Admin.init(Admin.java:26) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
Oh and I am running it just by clicking on the html file.
- 09-19-2008, 12:39 AM #7
Is the above class file in the jar file with the correct path?adminpanel/AdminPanelApp
Is the jar file in the ARCHIVE= attribute?
The JVM won't look in a jar file for a class just because it's there. You must tell it to look at the jar file..
- 09-21-2008, 03:19 PM #8
Member
- Join Date
- Sep 2008
- Posts
- 9
- Rep Power
- 0
okay, I've put the jar file in the adminpanel folder and changed AdminPanel.jar into adminpanel/AdminPanel.jar and the problem seems to be solved. Now I get another one:
Yeah, I know - it's just one after another error :) Thanks for your patience :)Java Code:javax.persistence.PersistenceException: No Persistence provider for EntityManager named fakerabbitPU: Provider named oracle.toplink.essentials.PersistenceProvider threw unexpected exception at create EntityManagerFactory: java.security.AccessControlException java.security.AccessControlException: access denied (java.util.PropertyPermission toplink.logging.level read)
- 09-21-2008, 04:15 PM #9
Applets are NOT allowed to read files on the local PC. You need to giver permission to the applet to allow it to access local PC files.access denied (java.util.PropertyPermission toplink.logging.level read)
There have been posts on this forum with all the details. Use Search for Permission or .java.policy for them.
- 09-21-2008, 07:00 PM #10
Member
- Join Date
- Sep 2008
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
Application starting initially
By rameshraj in forum Advanced JavaReplies: 14Last Post: 04-27-2008, 07:48 PM -
EventHandling code for Swing application
By Java Tip in forum Java TipReplies: 0Last Post: 12-07-2007, 12:06 PM -
swing application consumes much memory
By oregon in forum AWT / SwingReplies: 1Last Post: 08-05-2007, 08:25 AM -
Create Windows, Applet & Swing
By Eric in forum AWT / SwingReplies: 1Last Post: 07-05-2007, 06:36 AM -
Patterns to application with swing and hibernate
By Peter in forum JDBCReplies: 2Last Post: 07-04-2007, 06:58 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks