applet

how to provide access permission for applet to write on file system

不羁岁月 提交于 2019-12-23 15:58:57
问题 I have problem in setup of policy file for applet.I am doing this first time and don't know how to set the policy file for applet in java.Actually I want to give the permission to the applet to write on the file system. for Which I will have to give file permission to the applet So I make a file named .java.policy and and put the following code in it grant codeBase "file:/C://res/applet/*" { permission java.io.FilePermission "C:\\res\\applet\\test.txt", "read, write"; }; and save this in

java.lang.RuntimePermission when running a applet from the web application

梦想的初衷 提交于 2019-12-23 14:56:52
问题 I'm trying to read a envrionment varaible from a applet, here is my code String env = System.getenv("TWS"); System.out.println(env); Runtime rt = Runtime.getRuntime(); String s = env + "\\WebStart.bat " ; System.out.println(s); try { Process p = rt.exec(s); } catch (Exception e) { } when i run the code from netbeans by right click and run, it is running without a problem. but when i put it to a jar file, add it to my web application and try to run it from a html page using the following code

PrintServiceLookup.lookupDefaultPrintService() returns null

╄→гoц情女王★ 提交于 2019-12-23 13:59:08
问题 PrintServiceLookup.lookupDefaultPrintService() returns NULL as I have a printer installed and set to default printer. If I am using this in a simple program it works fine, but when I try to use it in my applet-based program it returns NULL . Please send me some good solution for this problem. 回答1: In order to access the printer (or any resource on the host computer for that matter) the jar file in which the applet code resides has to be signed, and the user must accept the signer as a trusted

Applet.getCodeBase() returns null for local Applets since Java 7 update 25

陌路散爱 提交于 2019-12-23 13:12:23
问题 Since Java 7 Update 25 , Applet's method getCodeBase() seems to return NULL for local applets. I haven't found anything in Java 7u25 release notes that would announce/explain this change, but I found an email discussion which claims the change is actually intended. Can anyone help me to find a resource/documentation where I could learn more about this change? 回答1: release notes are here: http://www.oracle.com/technetwork/java/javase/7u25-relnotes-1955741.html its in there. "Local Applets

Is it possible to read/write a file from an applet

孤街醉人 提交于 2019-12-23 12:34:26
问题 I've trying to read and write a file from an applet so if I run the applet from my appletviewer it is possible for me to read/write a file but when I try to do it from my browser I get a security exception. Any idea how to do this? 回答1: Is it possible to read/write a file from an applet Yes, but you need to sign the applet and get approval from the user. Some useful links: How can an Applet read files on the local file system (from coderanch.com) Essentials, Part 1, Lesson 6: File Access and

Java Applet Permissions

左心房为你撑大大i 提交于 2019-12-23 10:09:39
问题 I've put together a basic applet where the user selects a file from their hard drive, it reads the first line of this file and passes that off to JavaScript for some additional preprocessing, and then when you click a button it tries to upload that file through an HTTP POST request. I found a very basic open source applet for uploading files that I copied and modified for this last bit. The trouble is, though, it doesn't quite work. It seems like it's running fine, but then I run into two

using double buffering kinda ruin my applet. and it has java uses or overrides a deprecated API

☆樱花仙子☆ 提交于 2019-12-23 05:32:33
问题 this is my code actually it's just a moving space invader game. i search the internet for the animation i have tried the double buffering, it gets rid the flickering but its ruining the entire output. it also has java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. this is so hard... import javax.sound.sampled.*; import java.applet.*; import java.awt.*; public class SpaceInvaders extends Applet implements Runnable{ AudioClip soundFile1; int Xposition

Multiple screen java applet has buttons that don't work

扶醉桌前 提交于 2019-12-23 05:23:09
问题 I'm making a program that has 2 screens, a title and a game screen. If the user clicks "Play", they can proceed to the next screen. However, on the next screen if the user tries to press the button "Keep Going", nothing happens. I want to know why this is and if anyone can fix it. Thanks, and here is my code: import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class ZombieDice extends Applet implements ActionListener { Panel p_card; Panel card1,

Signed applet doesn't show publisher information

瘦欲@ 提交于 2019-12-23 05:22:51
问题 I signed my applet using .pfx file. But when I run my web page it shows "UNKNOWN publisher warning". I also have another certificate .cer (How to check that its a code signing certificate)[I got it from another person and he is also not sure]. So to sign applet, do I need special certificate say "Code Signing" certificate? Or I'm missing something? 回答1: A digital certificate that is generated by me or you will read UNKNOWN in that dialog. The reason is that if you can make a certificate

Signed applet doesn't show publisher information

旧城冷巷雨未停 提交于 2019-12-23 05:22:07
问题 I signed my applet using .pfx file. But when I run my web page it shows "UNKNOWN publisher warning". I also have another certificate .cer (How to check that its a code signing certificate)[I got it from another person and he is also not sure]. So to sign applet, do I need special certificate say "Code Signing" certificate? Or I'm missing something? 回答1: A digital certificate that is generated by me or you will read UNKNOWN in that dialog. The reason is that if you can make a certificate