I put absolute path for the codebase and archive.

For instance, my java applet class is located at C:\Users\xh2453\IBM\rationalsdp\workspace_70\TestWebAppl\WebContent\WEB-INF\classes

How can I change it to fit HTML tradition?

Read the doc for HTML syntax
Ask Google for how to code the applet archive= attribute
Ask Google for URL protocols.

I put everything in one directory (C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin) and call then from there and still get errors. Any clues for what's going on there?


Source code:

<html>
  <head><title>First Java Applet</title></head>
<body>
  <h2>My first Java Applet says:</h2>
  <applet
     code="com.test.xuggle.fileconvert.DecodeAndPlayVideo.class"
     archive="XuggleTest.jar, 
              commons-cli.jar,
              logback-classic.jar,
              logback-core.jar,
              slf4j-api.jar, 
              xuggle-xuggler.jar,
              xuggle-xuggler-test.jar"
     width="400" height="400">
  <param name="input" value="C:\test\input\waucissa.mov">    
  </applet>
</body>
</html>

__________________________________________________________________
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1df073d
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/XuggleTest.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/commons-cli.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-classic.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-core.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/slf4j-api.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler-test.jar
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/XuggleTest.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/XuggleTest.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/commons-cli.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-classic.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-core.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/slf4j-api.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler.jar, version: null]
java.lang.reflect.InvocationTargetException
at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\xh2453\IBM\rationalsdp\workspace_70\TestWebAppl\WebContent\images\music1.jpg 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 sun.awt.SunToolkit.getImageFromHash(Unknown Source)
at sun.awt.SunToolkit.getImage(Unknown Source)
at com.test.xuggle.fileconvert.DecodeAndPlayVideo.<init>(DecodeAndPlayVideo.java:38)
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.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception: java.lang.reflect.InvocationTargetException
Ignored exception: java.lang.reflect.InvocationTargetException

Caused by: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\xh2453\IBM\rationalsdp\workspace_70\TestWebAppl\WebContent\images\music1.jpg read)

Buried in the middle of the error messages.
Your code needs permission to read files that are not from its codebase.
Move that image file to the folder with the .class files and try it.

I have alerady included all library files under the same directory bin. Got this:


security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1e4cbc4
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/XuggleTest.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/commons-cli.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-classic.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-core.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/slf4j-api.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler.jar
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler-test.jar
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/XuggleTest.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/XuggleTest.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/commons-cli.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-classic.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-core.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/slf4j-api.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler.jar, version: null]
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 769062 us, pluginInit dt 260721 us, TotalTime: 1029783 us
Init...
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/slf4j-api.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-classic.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/logback-core.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/xuggle-xuggler-test.jar, version: null]
network: Cache entry not found [url: file:/C:/Users/xh2453/IBM/rationalsdp/workspace_70/XuggleTest/bin/, version: null]
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@1e4cbc4
Exception in thread "thread applet-com.test.xuggle.fileconvert.DecodeAndPlayVideo.class-1" java.lang.ExceptionInInitializerError
at com.xuggle.xuggler.IVideoResampler.isSupported(IVideoResampler.java:361)
at com.test.xuggle.fileconvert.DecodeAndPlayVideo.DecodeAndPlayVideo(DecodeAndPlayVideo.java:88)
at com.test.xuggle.fileconvert.DecodeAndPlayVideo.init(DecodeAndPlayVideo.java:79)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission java.library.path 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.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at com.xuggle.ferry.JNILibraryLoader.initializeSearchPaths(JNILibraryLoader.java:550)
at com.xuggle.ferry.JNILibraryLoader.getLibraryCandidates(JNILibraryLoader.java:479)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(JNILibraryLoader.java:257)
at com.xuggle.ferry.JNILibraryLoader.loadLibrary(JNILibraryLoader.java:168)
at com.xuggle.xuggler.XugglerJNI.<clinit>(XugglerJNI.java:19)
... 5 more

I have all permissions to all jar files. Why does it still complaint about the permission?

I cheecked java.policy and found no entry in

java.library.path read

Please help

What program generates that long error message you posted?

Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission java.library.path read)

It looks like you still do not have permission.

Did you look in the .java.policy file? Not the java.policy file. NOTE leading . in name
You can use the policytool program that comes with the IDE to edit the .java.policy file instead of using an editor.

After adding numerous permissions into my java.policy file, I finally got it to work. Thanks for your help.

What I've done for a quick way to test if your permissions file is being used, is to grant all permissions to all codebases. If the code now worked, then you could narrow down the permissions to the minimum.

I put all permissions under grant {..}, not under grant codebase {...}. Do I need to do the same thing in grant codebase{ }?

The grant without a codebase gives the included permissions to all codebases. If you want to limit the permissions to a single codebase, move the permissions to the grant that specifies that codebase.

I am kind of struggling with the codebase thing. I am testing my applet in my pc. How can I define my codebase? Absolute path is not accepted. Even relative path is not working either.

I've never been able to figure it out completely. It changes with each new version of the browsers. Here's a sample from my .java.policy file:

grant codeBase "file:/D:/JavaDevelopment/-" {
  permission java.io.FilePermission "<<ALL FILES>>", "read";
  permission java.util.PropertyPermission "*", "read, write";
};

grant codeBase "file:/C:/Miscellaneous/-" {
  permission java.io.FilePermission "C:/", "read";
};
/* These are for a search applet I use when searching local doc files */
grant codeBase "file:/E:/Java/-" {
  permission java.io.FilePermission "E:/", "read";
  permission java.io.FilePermission "E:/Java/Tutorial/", "read";
  permission java.io.FilePermission "E:/Java/Java-1_6_0/docs/", "read";
};

You're welcome

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.