• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems while Loading Applet...

 
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to Applets, I am using a Applet to load a JPanel to it. This Applet when I try to run through NetBeans I am able to run and see the output. Now when I try this into a html, I am not able to see its output. Can some one help on what should be done here.

My applet code looks like:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

And my html looks like

<html>
<head>
<title></title>
</head>
<body>
<applet code="CubeTestApplet.class" width="300" height="200" codebase="." ></applet>
</body>
</html>

Please help me whats wrong here. Thanks in Advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are there any messages either in the browser status bar or the Java Console?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes in the status bar I get Loading Java Applet failed is the message.

In the console it is

java.lang.NoClassDefFoundError: CubeApplet (wrong name: com/applet/cube/CubeApplet)

I have the html and the CubeApplet.class in the same directory. I have tried to use a jar which contains this class and specified the jar name in archive attribute, but all my efforts went in vein.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The directory hierarchy needs to reflect the package structure. The class file must be in a directory called "cubeapplet", which must in a directory called "cube", which must in a directory called "applet", which must be in a directory called "com", and that must be in the same directory as the HTML file.

If you're using a jar file, then that too needs to include the full directory structure.
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your helps so far. I am able to execute an sample applet. Now its time for heavy lifting. I am using a JPanel within the applet, the JPanel uses ResourceBundle within it. So when I try to open the panel in the browser I am getting null pointer exeption on loading the resource bundle. Can you help me on this?

java.lang.NullPointerException
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at com.neto2.attest.psd.PSD.<init>(PSD.java:62)

The line number 62 has the code to load a resource bundle.

Thanks in Advance
Ananth
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is PSD one of your classes, or is it a 3rd party library? Are there any resource bundles present?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PSD is one of my classes which returns a JPanel.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So is the resource bundle present? Where is it?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ResourceBundle resBundle = ResourceBundle.getBundle( Constants.MESSAGES_PROPERTY_FILE, Language.getInstance( ).getLocale( ) );

This was declared in my PSD. My problem was with loading the locale. Then I have loaded the language like this Language.getInstance( ).setLocale( new Locale( "en_US" ) );

Now I am getting a new problem in the console

Java Plug-in 1.5.0_09
Using JRE version 1.5.0_09 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\ananth_chellathurai


----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

sdf -null
java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
at com.neto2.attest.psd.PSD.getTopCPanel(PSD.java:116)
at com.neto2.attest.psd.PSD.<init>(PSD.java:94)
at com.neto2.attest.psd.PSDApplet.<init>(PSDApplet.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown ...

What could be wrong here?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am posting the constructor of my PSD class here

public PSD( String pktFileName )
{
super( TableLayout.PREFERRED ); // Setting top panel preferred.

super.addStarterPanel( getTopCPanel( resBundle.getString( "CP_Title_Filter" ) ) );
setPsdGPanel( new PSDCanvas( pktFileName ) );

super.add( getBottomCPanel( resBundle.getString( "CP_psd_title" ) ), TableLayout.PREFERRED );

setPsdPacket( new PSDPacketPanel( ) );
CollapsiblePanel psdCPacket = new CollapsiblePanel( " Packet Details" );
psdCPacket.add( getPsdPacket( ) );
super.add( psdCPacket, TableLayout.FILL );

getPsdGPanel( ).addMouseListener( new java.awt.event.MouseAdapter( )
{
public void mouseClicked( java.awt.event.MouseEvent evt )
{
psdGPanelMouseClicked( evt );
}
});
}

This is a working code in swing but I am not able to bring this into the applet. I am in a real hurry to rush this up. Please save me.
[ November 23, 2007: Message edited by: Ananth Chellathurai ]
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you referencing the jdesktop jar file in the archive attribute of the applet tag?
[ November 23, 2007: Message edited by: Ulf Dittmer ]
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No I am not using archive attribute in my html.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, then that's your answer. You need to put the jdesktop jar file(s) into the same directory as the HTML file, and then include it in the archive tag.
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forgive me on my ignorance can you say whats jdesktop jar?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have copied the swing-layout-1.0.jar to my html folder. And added this to the archive attribute but still I get the same exception. java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have copied the swing-layout-1.0.jar to my html folder. And added this to the archive attribute but still I get the same exception. java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group



What does your applet tag look like?

Does the swing-layout-1.0.jar file contain the org/jdesktop/layout/GroupLayout$Group class?
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
dear Ananth,

make a thorough look over your applt class,indded it's a member of swing package. to run your applet class from within html page you must run it first in html cnverter and then deploy it in your application.

hope this will help you

cheers
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by John Mclain:
indded it's a member of swing package. to run your applet class from within html page you must run it first in html cnverter and then deploy it in your application.


The jdesktop classes aren't part of Swing, so I'm not sure what you're alluding to. This is a question of classpaths, not a question of using HTML converter.
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes the swing-layout-1.0.jar, has the org.jdesktop.layout jar. My applet tag looks like

<APPLET codebase="classes" archive="swing-layout-1.0.jar" code="com/neto2/attest/psd/PSDApplet.class" width=850 height=300></APPLET>

Can you please tell me whats html convertor.

Thanks in Advance.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks correct, as long as swing-layout-1.0.jar is in the same directory as the HTML file. Let's not confuse the issue by talking about HTML converter; that doesn't help in this case.

The question remains whether swing-layout-1.0.jar actually contains the org/jdesktop/layout/GroupLayout$Group class?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya it has org.layout.GroupLayout class in it.
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you help me on what must be done next?

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm just noticing that "jdesktop" probably refers to JDIC - correct? That does include native components which make deployment as an applet somewhat tricky. But here's a lengthy FAQ entry on how to do that; are you following those steps?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No I did'nt follow this steps. I will try doing that and get back shortly. But when I am trying a sample with all panel related code within the Applet code I am able to open the applet succesfully. At that time I did'nt follow such steps, I dont know how I was able to get it there and not here. Any how I will try this.

Thanks
Ananth
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I unzipped swing-layout-1.0.jar which contains org\jdesktop... inside to my classes directory the applet is able to see the those classes. Now I have some 30 jars in a lib folder parallel to classes, should I have to unwrap all classes to make this Applet work? Can you give me a simple solution?

Ananth
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you should not have to do that. Maybe the JVM has problems accessing the swing-layout-1.0.jar file - does it have its permissions set correctly so that it is publicly accessible? Can you download it by entering its URL in a browser?
 
Ananth Chellathurai
Ranch Hand
Posts: 349
Hibernate Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf I have just fixed my problem like this

<APPLET codebase="classes" archive="../lib/swing-layout-1.0.jar" code="com/neto2/attest/psd/PSDApplet.class" width=850 height=350></APPLET>

Thanks for All your helps so far.
reply
    Bookmark Topic Watch Topic
  • New Topic