Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / March 2005

Tip: Looking for answers? Try searching our database.

inconsistent applet not inited error

Thread view: 
Keith McCullum - 03 Mar 2005 16:32 GMT
Been having trouble lately running a program I've been working on.  Here's
the backstory: I'm developing using Eclipse 3.0 and the Jigloo plug-in for
the GUI.  I can run an applet fine within Eclipse, but when I try to run
the applet through a .htm file, I get an error 'Applet CapsuleGui
notinited'.  I'm on a Windows XP sp1, J2SE 1.4.2_07 and JRE 1.5.0_01, with
the PATH variable looking at both java\bin directories.

In trying to troubleshoot, I got out my old CS files and opened up all the
applets I had.  A good portion worked, but some came back with the same
error and I can't find any correlation as to why.

I've posted the .class and .htm files at
http://bingweb.binghamton.edu/~kmccull1 but am not sure if more of the
files are needed.  Also if it helps troubleshoot, in the command prompt,
the 'java' command is recognized, but others like 'javac' and
'appletviewer' are not.  Like I said, both \bin directories are set in the
classpath.

Any help would be EXTREMELY appreciated and TIA.

-Keith
klynn47@comcast.net - 03 Mar 2005 16:46 GMT
It looks like it's a problem with packaging. Is the file
CapsuleGui.class located in the same directory as the .htm file? If
not, then you can include the codebase of where the .class is.
Keith McCullum - 03 Mar 2005 17:44 GMT
Yes, the .htm file is located in the same dir as the .class file.  The
packaging structure goes something like this

Project: Cap
-package: gui > CapsuleGui.java/.class
-package: operation > files that do the work in the program

I played around a little with the applet tag, but with no luck.  I just
added the entire project to the site
http://bingweb.binghamton.edu/~kmccull1 if that helps.  Thank you sooooo
much for your help with this.

ps- I forgot to mention that I'm primarily using Firefox, but get the exact
same error with IE6, as well as on my Win98se laptop using IE.
klynn47@comcast.net - 03 Mar 2005 17:48 GMT
Where is the gui directory relative to the .htm file?
Virgil Green - 03 Mar 2005 18:42 GMT
> Yes, the .htm file is located in the same dir as the .class file.  The
> packaging structure goes something like this
[quoted text clipped - 10 lines]
> ps- I forgot to mention that I'm primarily using Firefox, but get the
> exact same error with IE6, as well as on my Win98se laptop using IE.

Try:

<html>
<body>
<applet code = "gue/CapsuleGui" width=600 height=800>
</applet>
</html>

instead of what you have now. My java console indicated that
CapsuleGue.class was found, but it had the wrong name. You are missing your
package name.

--
Virgil
Virgil Green - 03 Mar 2005 20:39 GMT
>> Yes, the .htm file is located in the same dir as the .class file.
>> The packaging structure goes something like this
[quoted text clipped - 16 lines]
> <body>
> <applet code = "gue/CapsuleGui" width=600 height=800>

oops...

 <applet code = "gui/CapsuleGui" width=600 height=800>

that's better...

> </applet>
> </html>
>
> instead of what you have now. My java console indicated that
> CapsuleGue.class was found, but it had the wrong name. You are
> missing your package name.

--
Virgil
Keith McCullum - 03 Mar 2005 23:10 GMT
Thanks for the input, but still getting the 'Applet not inited' error.
Here's the output from my VM console:

load: class gui/CapsuleGui.class not found.
java.lang.ClassNotFoundException: gui.CapsuleGui.class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: h:\Huff Ice Cream\2-23\workspace\
Cap\bin\gui\gui\CapsuleGui\class.class (The system cannot find the path
specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown
Source)
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    ... 10 more
Virgil Green - 04 Mar 2005 16:17 GMT
> Thanks for the input, but still getting the 'Applet not inited' error.
> Here's the output from my VM console:
>
> load: class gui/CapsuleGui.class not found.
> java.lang.ClassNotFoundException: gui.CapsuleGui.class

Note the name of the class it tried to find includes the ".class" which it
should not.

> at sun.applet.AppletClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
[quoted text clipped - 9 lines]
> Cream\2-23\workspace\ Cap\bin\gui\gui\CapsuleGui\class.class (The
> system cannot find the path specified)

Note the path it is trying to find. "gui" is doubled and it tried to treat
"CapsuleGue" as a directory name and "class" as both a file name and
extension. I'm not very familiar with embedding applets, so I'm guessing a
bit at the proper syntax. However, this part of the message should be able
to give you the hints you need to go in the right direction.

By the way, the APPLET tag has be deprecated in favor of the OBJECT tag. You
should read (as I have been) at http://java.sun.com/plugin for more
information (though I don't find any good clear example there of specifying
an applet's package name.

> at java.io.FileInputStream.open(Native Method)
> at java.io.FileInputStream.<init>(Unknown Source)
[quoted text clipped - 7 lines]
> at java.security.AccessController.doPrivileged(Native Method)
> ... 10 more

--
Virgil
Virgil Green - 04 Mar 2005 16:50 GMT
>> Thanks for the input, but still getting the 'Applet not inited'
>> error. Here's the output from my VM console:
[quoted text clipped - 21 lines]
> Note the path it is trying to find. "gui" is doubled and it tried to
> treat "CapsuleGue" as a directory name and "class" as both a file

oops.... "CapsuleGui"

> name and extension. I'm not very familiar with embedding applets, so
> I'm guessing a bit at the proper syntax. However, this part of the
> message should be able to give you the hints you need to go in the
> right direction.

forgot to say... use "gui.CapsuleGui" for your code parameter rather than
"gui/CapsuleGui.class" and see if that fixes it. I realize that every
example I see for APPLET has ".class" in the code parameter, so I'm not
certain about this.

> By the way, the APPLET tag has be deprecated in favor of the OBJECT
> tag. You should read (as I have been) at http://java.sun.com/plugin
[quoted text clipped - 13 lines]
>> at java.security.AccessController.doPrivileged(Native Method)
>> ... 10 more
--
Virgil
Keith McCullum - 07 Mar 2005 07:00 GMT
Here's an interesting new development.  As per your suggestion, I switched
over to the object tag after reading up on it.  It has the safety net
message which just happens to display on error.  It says: " No Java 2 SDK,
Standard Edition v 1.3 support for APPLET!!"  hmmmmmm, I think I see the
problem.

I apologize for not knowing a good way to test what I have on here.  As you
know, I'm developing with no issues regarding classes not being found for
code.  Here's what appears to be installed on my system drive:

F:\Program Files\Java\jre1.5.0_01 and
F:\j2sdk1.4.2_07

And for good measure, here is the updated file, H:\Huff Ice Cream\Current
IP\workspace\Cap\bin\gui\CapsuleGui.hmtl

and it contains:

<html>
<body>

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
   width="600" height="750" align="baseline"
   codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-
win32.cab#Version=1,3,0,0">
   <PARAM NAME="code" VALUE="CapsuleGui.class">
   <PARAM NAME="codebase" VALUE="html/">
   <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
   <PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
   <PARAM NAME="scriptable" VALUE="true">
       No Java 2 SDK, Standard Edition v 1.3 support for APPLET!!
</OBJECT>

</applet>
</body>
</html>

Phew, didn't think I was going to type up this much.  I really appreciate
all the help with this, I can't thank you enough.  And it really speaks to
the community of developers.  It's satisfying, since I'll be entering
professionally soon.

Let me know what you think of the situation when you can.

-Keith
Keith McCullum - 07 Mar 2005 07:37 GMT
So I did a little more searching and found my way to the java.com 'verify
install' site.  I saw the coffee cup fine, but oddly enough, the site
linking me there said gave me the error message: No Java 2 SDK, Standard
Edition v 1.3 support for APPLET!! Sorry, your browser doesn't support Java.

Any ideas? TIA

-Keith
Virgil Green - 07 Mar 2005 17:03 GMT
> Here's an interesting new development.  As per your suggestion, I
> switched over to the object tag after reading up on it.  It has the
> safety net message which just happens to display on error.  It says:
> " No Java 2 SDK, Standard Edition v 1.3 support for APPLET!!"
> hmmmmmm, I think I see the problem.

From your IE Browser: Tools | Internet Options | Advanced - scroll down to
the Java section and make sure you have the "Use Java xxxxx for <applet>
(requires restart)" turned on.

--
Virgil
Keith McCullum - 07 Mar 2005 22:34 GMT
Under IE, Tools > Internet Option > Advanced, there is an item under Java
(Sun) that you're describing.  It's already selected and says 'Use JRE
1.5.0_01 for <applet> (requires restart).'  Does it matter that I switched
over to the <object> tag?

Same results as before, however.
Nigel Wade - 08 Mar 2005 10:08 GMT
> Thanks for the input, but still getting the 'Applet not inited' error.
> Here's the output from my VM console:
>
> load: class gui/CapsuleGui.class not found.

What is the package declaration in CapsuleGui.java?

If it's in the package gui then you need to reflect that in the layout of
the classes on the website by putting CapsuleGui.class in the gui
directory, and specifying the code as gui/CapsuleGui.class.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Keith McCullum - 09 Mar 2005 19:21 GMT
> What is the package declaration in CapsuleGui.java?

package gui;

As for the layout of the website, CapsuleGui.class is located in
Cap/bin/gui/ and the .html file is in the same directory.  

Using either value="gui/CapsuleGui.class" or value="CapsuleGui.class"
yields the same non-functioning results.

Does it seem like it's more of a Java Virtual Machine issue? Just a
thought.  Thanks for the help, Nigel
Nigel Wade - 10 Mar 2005 11:07 GMT
>> What is the package declaration in CapsuleGui.java?
>
[quoted text clipped - 8 lines]
> Does it seem like it's more of a Java Virtual Machine issue? Just a
> thought.  Thanks for the help, Nigel

It's a directory layout issue.

Because the class CapsuleGui is in the package gui it must be in a directory
called gui within one component of the classpath. The default classpath for
an applet is the directory from which the html file is loaded. So, create a
gui sub-directory below this directory and put CapsuleGui.class in there.
Then use value="gui/CapsuleGui.class".

Your package structure must be mapped onto the directory structure in order
for the classloader to locate the relevant class.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Keith McCullum - 10 Mar 2005 11:35 GMT
Check bingweb.binghamton.edu/~kmccull1 for correctness of directory
structure.  I believe everything is where it should be.  I moved the
CapsuleGui.html file up one level so that it's just above
/gui/CapsuleGui.class .  On my end, I'm still getting ' No Java 2 SDK,
Standard Edition v 1.3 support for APPLET!!'  Thanks for your suggestions.

-Keith
Roland - 10 Mar 2005 12:00 GMT
> Check bingweb.binghamton.edu/~kmccull1 for correctness of directory
> structure.  I believe everything is where it should be.  I moved the
[quoted text clipped - 3 lines]
>
> -Keith

Try to replace
    <PARAM NAME="codebase" VALUE="html/">
with
    <PARAM NAME="codebase" VALUE=".">

and
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
with
    <PARAM NAME="type" VALUE="application/x-java-applet">

Unless they are of significance to you applet, remove
    <PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz">
and
    <PARAM NAME="scriptable" VALUE="true">

I tried it with the following <applet> tag in a HTML file on my
computer, and it worked:
<applet width="500" height="400"
        codebase="http://bingweb.binghamton.edu/~kmccull1/Cap/bin/"
        code="gui/CapsuleGui.class">

However, when the applet loads, the following security exception is
thrown and displayed in the Java console:
java.security.AccessControlException: access denied
(java.io.FilePermission H:\Huff Ice Cream\Input Files\current year item
history.txt read)
   at java.security.AccessControlContext.checkPermission(Unknown Source)
   at java.security.AccessController.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkPermission(Unknown Source)
   at java.lang.SecurityManager.checkRead(Unknown Source)
   at java.io.RandomAccessFile.<init>(Unknown Source)
   at operation.InputFormatter.readItemHist(InputFormatter.java:336)
   at gui.CapsuleGui.initInput(CapsuleGui.java:119)
   at gui.CapsuleGui.<init>(CapsuleGui.java:100)

This is because your applet tries to open a file on the local file
system, but this is denied because applets, by default, are not allowed
to read or write to the local filesystem.
Signature

Regards,

Roland de Ruiter
  ___      ___
 /__/ w_/ /__/
/  \ /_/ /  \

Virgil Green - 10 Mar 2005 17:36 GMT
> Check bingweb.binghamton.edu/~kmccull1 for correctness of directory
> structure.  I believe everything is where it should be.  I moved the
[quoted text clipped - 4 lines]
>
> -Keith

Like Roland, I attempted to recreate this. However, I pulled the files off
your server and put them on my own. I then removed the codebase parameter
(rather than setting it to an empty string like Roland) and attempted to
execute. I got a failure message as well, but it was because I don't have
InputFormatter available. The gui.CapsuleGui class was being loaded, it just
couldn't run. Make sure that you review the stack trace in the Java console
each time you have a failure.

java.lang.NoClassDefFoundError: operation/InputFormatter
at gui.CapsuleGui.initInput(CapsuleGui.java:109)
at gui.CapsuleGui.<init>(CapsuleGui.java:100)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

--
Virgil


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.