Problem in display file in java applet embeded browser
hi, i am facing problem to display the file from local drive in java applet embeded browser. here is the error message i get:
Exception loading file from path:java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
i think it should be the java security problem and i have try to get the solution from internet. i try to solve by using the fllowing method:
keytool -genkey -keyalg rsa -alias yourkey
keytool -export -alias yourkey -file yourcert.crt
javac yourapplet.java
jar cvf yourapplet.jar yourapplet.class
jarsigner yourapplet.jar yourkey
but the command prompt ask me to enter the keystore password. i try to enter any password. but i show me the error:
keytool error: java.io.IOException: Keystore was tampered with, or password was incorrect.
So may i know what is the problem actually?Thanks a lot.
Hi,
here is the sample coding :
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.applet.MainFrame;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
import com.sun.j3d.utils.behaviors.mouse.MouseZoom;
import com.sun.j3d.utils.behaviors.mouse.MouseTranslate;
import javax.media.j3d.*;
import javax.vecmath.*;
import java.net.URL;
import java.net.MalformedURLException;
import org.web3d.j3d.loaders.VRML97Loader;
import com.sun.j3d.loaders.Scene;
public class SimpleVrml extends Applet implements ActionListener {
String location;
String initLocation;
Canvas3D canvas;
SimpleUniverse universe;
TransformGroup vpTransGroup;
VRML97Loader loader;
View view;
Panel panel;
Label label;
BranchGroup sceneRoot;
TransformGroup examineGroup;
BranchGroup sceneGroup;
BoundingSphere sceneBounds;
DirectionalLight headLight;
AmbientLight ambLight;
TextField textField;
Cursor waitCursor;
Cursor handCursor;
public SimpleVrml() {
initLocation="cylinder.wrl";
setLayout(new BorderLayout());
GraphicsConfiguration config =SimpleUniverse.getPreferredConfiguration();
setLayout(new BorderLayout());
canvas = new Canvas3D(config);
add("Center",canvas);
panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
textField = new TextField(initLocation,60);
textField.addActionListener(this);
label = new Label("Location:");
panel.add(label);
panel.add(textField);
add("North",panel);
waitCursor = new Cursor(Cursor.WAIT_CURSOR);
handCursor = new Cursor(Cursor.HAND_CURSOR);
universe = new SimpleUniverse(canvas);
ViewingPlatform viewingPlatform = universe.getViewingPlatform();
vpTransGroup = viewingPlatform.getViewPlatformTransform();
Viewer viewer = universe.getViewer();
view = viewer.getView();
setupBehavior();
loader = new VRML97Loader();
gotoLocation(initLocation);
public void actionPerformed(ActionEvent ae) {
gotoLocation(textField.getText());
void gotoLocation(String location) {
canvas.setCursor(waitCursor);
if (sceneGroup != null) {
sceneGroup.detach();
Scene scene = null;
try {
URL loadUrl = new URL(location);
try {
// load the scene
scene = loader.load(new URL(location));
} catch (Exception e) {
System.out.println("Exception loading URL:" + e);
} catch (MalformedURLException badUrl) {
// location may be a path name
try {
// load the scene
scene = loader.load(location);
} catch (Exception e) {
System.out.println("Exception loading file from path:" + e);
if (scene != null) {
// get the scene group
sceneGroup = scene.getSceneGroup();
sceneGroup.setCapability(BranchGroup.ALLOW_DETACH);
sceneGroup.setCapability(BranchGroup.ALLOW_BOUNDS_READ);
// add the scene group to the scene
examineGroup.addChild(sceneGroup);
// now that the scene group is "live" we can inquire the bounds
sceneBounds = (BoundingSphere)sceneGroup.getBounds();
// set up a viewpoint to include the bounds
setViewpoint();
canvas.setCursor(handCursor);
void setViewpoint() {
Transform3D viewTrans = new Transform3D();
Transform3D eyeTrans = new Transform3D();
// point the view at the center of the object
Point3d center = new Point3d();
sceneBounds.getCenter(center);
double radius = sceneBounds.getRadius();
Vector3d temp = new Vector3d(center);
viewTrans.set(temp);
// pull the eye back far enough to see the whole object
double eyeDist = 1.4*radius / Math.tan(view.getFieldOfView() / 2.0);
temp.x = 0.0;
temp.y = 0.0;
temp.z = eyeDist;
eyeTrans.set(temp);
viewTrans.mul(eyeTrans);
// set the view transform
vpTransGroup.setTransform(viewTrans);
private void setupBehavior() {
sceneRoot = new BranchGroup();
examineGroup = new TransformGroup();
examineGroup.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
examineGroup.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
examineGroup.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
examineGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
examineGroup.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
sceneRoot.addChild(examineGroup);
BoundingSphere behaviorBounds = new BoundingSphere(new Point3d(),
Double.MAX_VALUE);
MouseRotate mr = new MouseRotate();
mr.setTransformGroup(examineGroup);
mr.setSchedulingBounds(behaviorBounds);
sceneRoot.addChild(mr);
MouseTranslate mt = new MouseTranslate();
mt.setTransformGroup(examineGroup);
mt.setSchedulingBounds(behaviorBounds);
sceneRoot.addChild(mt);
MouseZoom mz = new MouseZoom();
mz.setTransformGroup(examineGroup);
mz.setSchedulingBounds(behaviorBounds);
sceneRoot.addChild(mz);
BoundingSphere lightBounds =
new BoundingSphere(new Point3d(), Double.MAX_VALUE);
ambLight = new AmbientLight(true, new Color3f(1.0f, 1.0f, 1.0f));
ambLight.setInfluencingBounds(lightBounds);
ambLight.setCapability(Light.ALLOW_STATE_WRITE);
sceneRoot.addChild(ambLight);
headLight = new DirectionalLight();
headLight.setCapability(Light.ALLOW_STATE_WRITE);
headLight.setInfluencingBounds(lightBounds);
sceneRoot.addChild(headLight);
universe.addBranchGraph(sceneRoot);
public static void main(String[] args) {
new MainFrame(new SimpleVrml(), 780, 780);
cylinder.wrl :
#VRML V2.0 utf8
# A cylinder
Shape {
appearance Appearance {
material Material { }
geometry Cylinder {
height 2.0
radius 1.5
view.html:
<html>
<applet code="SimpleVrml.class" width=600 height=600>
</applet>
</html>
error msg that i get :
Exception loading file from path:java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
i can display the wrl file in applet itself but i can't display in the browser.is it any problem with my code?Urgent, please help me. Thanks.
Similar Messages
-
File Uploader Java Applet cannot be run
I have a website that I need to upload PDFs to, but since ugrading to Lion, I cannot do it any more. I have downloaded the separte Java app, but it still does not work.
This is the error message I get:
File Uploader Java Applet cannot be run. Make sure that Java is installed on your PC and Java applets are permitted in browser settings. Use this link to download and install appropriate version of Java:Thank you etresoft - that did not solve the problem. However, I did fix it by changing something in Java Preferences (which is located in the Utilities Folder).
I first deleted the cache files as you suggested in the Network tab. Then I quit and restarted Firefox. I still got the same error message when I tried to upload.
Then, I went back into Java Preferences and checked the box, "Enable Appplet Plug-in and Webstart Applications" located in the General Tab. I then quit and restarted Firefox. Now I am able to upload documents as I could before Lion.
Thank you!! -
On certain web sites(with java applets embedded or rich content),sometimes browser hotkeys are beeing used with other functionality (eg.: youtube uses ctrl + tab for sliding between player controls).How can I prevent this ?
Thanks for posting this!
I would only mention that your definition is incomplete for this -
Contextual selector A type of Style Sheet Selector that
and that it's most often referred to now as a Descendent selector, not a contextual selector. It's basically the same as the Compound selector that you have already defined.... -
How to display a .exe file in java applets by avoiding the file downloadbox
Hi sir,
I know that in order to display a any file(or)program in java applets you need to use showDocument().Where you cannot use exec() in java applets.
My problem is that when i use showDocument() to display .exe file.It is showing a file download dialog box.If we click & open only it is opening that .exe file.Here i want to open the .exe file without showing that file download dialog box in java applets.
Since,i am undergoing a project which involves it,it is quite urgent.pls.do provide the exact code in java applet without showing that file download dialog box.If it can't be done pls. do provide any other possibilities in order to be displayed on the browser.Thank U.
Regards,
m.ananthuHi!
I think you it's better to write a server socket program
in server and open a socket connection to server socket then
send exe file content via connection.
(I guess you know applets only have permission to open socket connection to their code base)
Bye! -
Problem facing when uploadin file thru java applet using WSA
I am facing a issue, when I am trying to upload a pdf file on a website which uses java applet and WSA as proxy. On the java applet window when I select the file a click upload, it gives " Upload failed : java.net.Unknownhostexception ".
On checking the issue in java console getting following error "SEVERE: java.net.UnknownHostException: www.mca.gov.in
java.net.UnknownHostException: www.mca.gov.in
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:86)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:652)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:628)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:497)
at javazoom.transfer.client.http.HTTPTransfer.headInfo(Unknown Source)
at javazoom.transfer.client.http.HTTPUploadTransfer.dbupdate(HTTPUploadTransfer.java:973)
at javazoom.transfer.client.http.HTTPUploadTransfer.run(HTTPUploadTransfer.java:155)
at java.lang.Thread.run(Unknown Source)
network: Connecting http://www.mca.gov.in:80/ with proxy=DIRECT
29-Oct-2009 15:03:58 javazoom.transfer.client.http.HTTPTransfer headInfo
SEVERE: java.net.UnknownHostException: www.mca.gov.in
29-Oct-2009 15:03:58 javazoom.transfer.client.http.HTTPUploadTransfer run
INFO: Upload failed"Done, what next ?
Noah -
Strange......problem with batch file in java
hi,
my problem is that i have created one bat file and i want to run that file in java but it is not running properly. the problem is .......
i have created one bat file named "file1.bat" & content of this file is as follows :-
[ ag > b.txt]
(and content of file "ag" is "aaaaaaa" )
now i am trying to run this bat file in java and want to read this b.txt in which i have redirected the content of file "ag".
for that i have written the code like this:-file name is "runbf.java"
import java.awt.*;
import java.lang.Runtime;
import java.io.*;
public class DriveVol
public static void main(String args[]) throws IOException
int volumn;
Runtime r = Runtime.getRuntime();
r.exec("ss.bat");
FileInputStream fp;
fp = new FileInputStream("b.txt");
flush();
do
volumn = fp.read();
System.out.print((char)volumn);
}while(volumn != -1);
fp.close();
when i am running this programme first it is not displaying the content of b.txt. but when u run this prog twice then only it 'll give the correct ans. what i mean is, i'll explain that stepwise.
1. as per my prog. -- r.exec("aa.bat") -- this line 'll execute first. so content of ag 'll redirect to file "b.txt"
2. now i am trying to read the file "b.txt" using FIleInputStream...
3. but first time it is giving some garbbage value.when i give --c:jdk1.3\bin>java runbf
4. but the very next moment when again i run that file - c:jdk1.3\bin>java runbf
it 'll give the correct value.
5. again when i change the content of file ag(suppose "bbbbbbb"). & try to run "runbf.java" like this-
-- c:jdk1.3\bin>java runbf --
6. then it 'll display the value "aaaaaa". now when again i run that file
it 'll give the correct value "bbbbbb"
7. so every time i have to run that "runbf.java" twice for printing the correct
value of file "b.txt"
so what i think is that, it is not refreshing the data of file "b.txt". after executing this line
r.exec("aa.bat");
so is there any method to refresh the data of file "b.txt"??????
i think u 'll try to understand my problem...
so please help me to get the ans.......
thx.........pls can anyone hlp............
-
Read, Write and create files from java applet.
Dear All,
I have created a two files. One is applet and one application file. I am creating a instance of application file in applet. Application file is used for reading, writing and creating files. When I invoke applet from broser it dipslays error wrt file access permission. From the forum search I know that we need to sign the applet / edit the java policy to run the code locally. Final delivery of my code should execute on different system. Its not web. I have created a html page on submitting the form it invokes applet to read the form values from param and needs to update the values in xml file located locally. Please help me on how I can proceed with this fix.
Thanks in advance.Sorry if I have not stated the problem clearly. I need to update content to files hosted in local system using java applets.
I belive there are two ways to achive that.One with jar signer and one with modifying the java policy file. But this application needs to be installed in different system locally as I have created a application with webpage as useinterface and need to update the content in local files on submission. Not sure on how to modify the java.policy files in each end user system and whats the value we need to update in java policy file. Please help me on the steps to be followed -
Problem with display of images in applets
Hi all,
When I run this program, the appletviewer window is showing no output (i.e. no image). I'm using the netbeans IDE 5.0.
Blue hills.jpg is present in both the src folder and build folder.
* <applet code="image" width =800 height=600>
* <param name="img" value="Blue hills.jpg">
* <\applet>
import java.awt.*;
import java.applet.*;
public class image extends Applet {
Image img;
public void init() {
img=getImage(getDocumentBase(), getParameter("img"));
public void paint(Graphics g){
g.drawImage(img,0,0,this);
Please help in figuring out the problem....It will be looking for it in the folder with the HTML that invokes the applet.
If you want to pack the image in with the applet then use getResource instead.
And spaces in the name are probably not the best idea. -
Problems with jumping ball in Java applet
The ball is supposed to jump to the same height from which it fell down, someway it always gets higher and higher. My question is why?
import java.applet.*;
import java.awt.*;
public class Bug extends Applet implements Runnable
private int y_pos = 200;
private int y_speed = 0;
private int radius = 20;
private int appletSize_x = 400;
private int appletSize_y = 400;
private Image dbImage;
private Graphics dbg;
public void run(){
while(true){
y_speed++;
if ((y_pos > appletSize_y)&& (y_speed > 0))
y_speed = (-1)*(y_speed);
y_pos += y_speed;
repaint();
//controls the time
try{
Thread.sleep(20);
catch (InterruptedException ex){}
public void update (Graphics g){
if (dbImage == null)
dbImage = createImage (this.getSize().width, this.getSize().height);
dbg = dbImage.getGraphics ();
dbg.setColor (getBackground ());
dbg.fillRect (0, 0, this.getSize().width, this.getSize().height);//erase this line to understand better
dbg.setColor(getForeground());
paint(dbg);
g.drawImage (dbImage, 0, 0, this);
public void stop(){}
public void destroy(){}
public void start(){
Thread th = new Thread(this);
th.start();
public void paint(Graphics g){
g.setColor(Color.green);
g.fillOval (30 - radius, y_pos - radius, 2 * radius, 2 * radius);
}Shurik007.5 wrote:
The ball is supposed to jump to the same height from which it fell down, someway it always gets higher and higher. My question is why?
g.fillOval (30 - radius, y_pos - radius, 2 * radius, 2 * radius);There are variables here involved in what gets drawn, no? And do (some of) these variables change during the lifetime? Yes. So, there should be no question about why the display changes.
Edit: I guess your question is more about "why doesn't y_pos keep cycling back and forth between the same two values?" I'd suggest you do some debugging, to make the computer tell you what the values are at each step until you understand what is going on. The simple answer is "It did what you told (programmed) it to do", of course. -
Problem in displaying file thru FDTA
hi all,
we have a problem with FDTA while displaying the content of DME file which generated through FBWE transaction for Bill of Exchanges.
it is showing some chinese characters in dispaly.
but when we down load the file into PC the file getting downloaded in correct format.
the problem here is user is looking for display functionality of the file.
if any body came across with this issue, please share about.
ChandraHi Chandra.
I'm facing the same problem. Have you solved it?
Now I'm generating DME from transaction F110. And I've noticed that it happens in prod.system, in QAS or dev. no problem with showing files.
Thanks, Mau -
JAVA Applet embedded in a JSP MI Application.
Hi
I am trying to include a Java Applet into a JSP page in my MI application. The code is as follows:
<jsp:plugin type = "applet"
code = "com.mycompany.applet.myApplet.class">
</jsp:plugin>
It gave me a Class Not Found exception. If I place the class in the same directory that the JSP resides it works properly. It seems that I need to set the codebase and/or archive property to work. But every value I use to set them still gaves me the CLASS NOT FOUND Exception. I am using MI2.5 and the jar file is located at MYAPPS/WEB-INF/lib folder. Any suggestion will be appreciated.Hi,
plz try the following and see whether it can be of any help.
<jsp:plugin type = "applet"
code = "com.mycompany.applet.myApplet.class
codebase=http://localhost:4444/*>
</jsp:plugin>
OR
<jsp:plugin type = "applet"
code = "com.mycompany.applet.myApplet
archive="Applet.jar" -
> jar
codebase=http://localhost:4444/*>
</jsp:plugin>
The codebase plays an important role as when u r running it relatively on a web server, the path for code base becomes relative as is described above.
plz try this and let me know.
regards
anubhav -
Can i open a ppt file in java applet?
is there any to show a power point presentation through java applet i
None readily available as far as I know (Jakarta HSSF POI doesn't seem to be there yet IIRC), but I'm sure it's possible to write one oneself...
-
Printing problem with RTF file in java
Hi,
i actually got code to print the RTF doc using java, it works fine if we give small content (some text), but throws error 'java.io.ioException: Too many close-groups in RTF " when actual bill content is pass.
Thanks in advanceCan you please share the code to print the RTF file using java API
-
I have a station that will not display a particular java applet.
It has had 1.4, then 6.0 and when attempting to click on the applet of a calendar, a box pops up, then waits a second, then shows a red x.
So I uninstalled all Java, rebooted, and installed 5.0.12 etc.
It still does it and if you hit cancel, it puts undefined in the box where the date should belong on the form.
I turned on through the console the logging and this is what appears if I look at the calendar after looking at a working java applet off of Sun's webpage. I only cut and pasted what appeared after I typed the address into the address bar and entered through it.
(ok. starting below...)
basic: Stopping applet ...
basic: Finding information ...
basic: Releasing classloader: sun.plugin.ClassLoaderInfo@1a082e2, refcount=0
basic: Caching classloader: sun.plugin.ClassLoaderInfo@1a082e2
basic: Current classloader cache size: 1
basic: Done ...
basic: Joining applet thread ...
basic: Destroying applet ...
basic: Disposing applet ...
basic: Joined applet thread ...
basic: Unregistered modality listener
basic: Quiting applet ...
(ok thats it)I think any version below version 1.6 doesn't have
javax.swingThat's 1.1.6, not 1.6 ;) -
Problem running jar files of java in Linux
I cannot run jar files in java/jdk1.3.1_01/demo in Readhat Linux 6.2
The command is :--
[root@localhost Notepad]# java -jar Notepad.jar
java.lang.NoClassDefFoundError: javax/swing/JPanel
at java.lang.Class.forName(Class.java:33)
at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
at kaffe.jar.ExecJar.main(ExecJar.java:61)
[root@localhost Notepad]#
My ~/profile setting is :---
PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/usr/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
export JAVA_HOME=/usr/java/jdk1.3.1_01
export NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/ns4[root@localhost Notepad]# java -jar Notepad.jar
java.lang.NoClassDefFoundError: javax/swing/JPanel
at java.lang.Class.forName(Class.java:33)
at
at
at kaffe.jar.ExecJarName.main(ExecJarName.java:58)
at kaffe.jar.ExecJar.main(ExecJar.java:61)
[root@localhost Notepad]#
My ~/profile setting is :---
PATH="$PATH:/usr/X11R6/bin:/usr/java/jdk1.3.1_01/bin:/u
r/java/jdk1.3.1_01/jre/bin:/usr/java/jre/lib"
export JAVA_HOME=/usr/java/jdk1.3.1_01
export
NPX_PLUGIN_PATH=/usr/java/jdk1.3.1_01/jre/plugin/i386/n
4Add the line:
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar
Then, run the command "source ~/.profile" and then the jar file should be able to run.
Bhav
Maybe you are looking for
-
Connecting to HDMI & SVIDEO - such a adapter?
I have an SVideo projector and a HD LCD in my lounge. Currently I have an adapter for my mac mini which allows me to connect to teh projector via Svideo and to my LCD via VIdeo but really, I would rather connect to my LCD via HDMI. is there such a co
-
Hello, We have crystal reports published on the BOBJ system and the datasource is SAP BI system . The reports were working fine untill last monday when they started giving error " Database Connection Error " . This is what happening, when we run the
-
I can only see e top bar, with the rewind/play/fast forward buttons and song title, the rest od the screen is just blank
-
Leave Handle Units and keep Storage Units in WM
Hi all, I'm searching for a solution to leave our HUM and "transfer" existing stocks keeping the Storage Unit number. Thanks for your ideas ! Regards, Eric Colas
-
SD SAP Variant Configuration questions
Hello guys, I'm preparing for an exam and trying to find the answers for the following questions, please help me, I need them as soon as possible, full points will be given to any answer, Thanks all ! - What is variant configuration? - What is charac