• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

how to execute applet through webserver

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is the exception i amgetting sir pl help me


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


----------------------------------------------------
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>
----------------------------------------------------

load: class java.Backup not found.
java.lang.ClassNotFoundException: java.Backup
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.IOException: open HTTP connection failed.
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

i am getting this one

and my applet tag in html is in this way

<Applet code="java.Backup" Width=920 height=580 >
<PARAM NAME="questionDir" VALUE="/AllQuestions">
</Applet>

and my directory structure is

appletcode ( App.html)/WEB-INF/classes/java(applet class file ,AllQuestion folder)

this online exam project where i am reading the questions from folder AllQuestions and display it in applet when i click the button this folder is in java as shown in above directory structure

pl pl
pl
help me

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
Nothing that's inside of the WEB-INF directory will be served to a browser. You'll need to move all files related to the applet into a publicly accessible directory (like the one where the HTML file resides in). That includes class files, jar files (if any) and data files (like questionDir).
 
feroz pasha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i did in that way also but it was showing the java.io.filepermission and AccessControlException


wat sall i do for this can you help me pl pl
 
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
Dear Pasha,

You need to go through some basics of Applets. Please visit FAQ session to have some basic ideas of Applet.

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
Whenever you mention that you're getting exceptions you should post the full stack trace. There's additional information in the exception message that helps diagnose the problem. Without that, people here can only guess what's going on.
 
feroz pasha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java Plug-in 1.5.0_12
Using JRE version 1.5.0_12 Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Emminent


----------------------------------------------------
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>
----------------------------------------------------

The Direcory location=null
Full directory path=/localhost:7001/appletcodenull
java.security.AccessControlException: access denied (java.io.FilePermission \localhost:7001\appletcodenull 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.File.isDirectory(Unknown Source)
at Backup.init(Backup.java:131)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


this is the exception i am getting sir
help me what is the next step shall i take to over come the exception
 
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 fact that the file path contains the string "null" should be a clear indication of what is going wrong.

Aside from that, applets are not allowed to perform file I/O without being signed, or unless the local security policy has been altered. It looks as if neither is the case. See HowCanAnAppletReadFilesOnTheLocalFileSystem for more detail.
 
Rancher
Posts: 5127
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like your code is executing but:

at java.io.File.isDirectory(Unknown Source)
at Backup.init(Backup.java:131)


Is your applet at source line 131 trying to look at the local file system?
Applet's can't do that without permission.
 
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
Applets can look only for files from the server from where it is served from.

Ananth Chellathurai
 
feroz pasha
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have set the access permission buy
keytool -genkey -keyalg rsa -alias feroz
after i made the certificate:

keytool -export -alias feroz -file yourcert.crt

after that i have created a bat file which contains

javac Backup.java
jar cvf Backup.jar Backup.class
jarsigner Backup.jar feroz


The batch-file compiles the applet, makes a jar-archive and signs the jar-file.

but when i am running my html file iam getting this exception.

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


----------------------------------------------------
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>
----------------------------------------------------

file:/C:/AppletCode/AllQuestions/Question1.java
java.lang.SecurityException: class "Backup$1"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
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 java.lang.ClassLoader.loadClassInternal(Unknown Source)
at Backup.init(Backup.java:154)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
what should i do
 
reply
    Bookmark Topic Watch Topic
  • New Topic