Applet.getImage(URL) problem

My computer is installed with JRE7. I found that calling getImage from applet will send the request twice to the server. The request being send to server is http://server:8000/abc?id=100.
The first request received by server is http://server:8000/abc%3fid%3d100. [which is failed]
The second request received by server is http://server:8000/abc?id=100. [which is ok]
My code simply call the following line once:
theApplet.getImage (theApplet.getCodeBase(), "abc?id=100");
Is this a bug in the Java plugin?

I have had exactly the same problem with Applet.getImage.
In previous JRE versions, Applet.getImage returned immediately,
but this has apparently changed (I don't know at which version).
I had to rewrite my program to use Applet.getToolkit().getImage
- then the program worked as before...
Looks like a bug to me.
H�vard Tveite

Similar Messages

  • Applet.getImage(URL url) question

    Hi,
    I experienced delays of up to several hundreds milliseconds for calling Applet.getImage(URL url) when accessing an image the first time.
    The API states that "This method always returns immediately, whether or not the image exists." but this does not seem to be correct. In contrast, Applet.getToolkit().getImage() returns immediately.
    What are the differences between these two methods?
    What caching mechanisms (browser, SUN cache) are running behind the scenes?
    Used environment: IE6/Java1.5, IE6/Java1.6, Firefox2/Java1.6 ...all running under WinXP.
    Thank you so much!

    I have had exactly the same problem with Applet.getImage.
    In previous JRE versions, Applet.getImage returned immediately,
    but this has apparently changed (I don't know at which version).
    I had to rewrite my program to use Applet.getToolkit().getImage
    - then the program worked as before...
    Looks like a bug to me.
    H�vard Tveite

  • Getting error while using getImage(URL, filename) and imageUpdate()

    Hello Everyone,
    I am trying to create an image and upload it in an applet. I have kept the image file in the same directory as of the HTML and java-applet file. I have used the getImage(URL, filename) abstract method to do so. The image is not getting uploaded .... PLEASE HELP .... Please find the code attached below.
    import java.awt.*;
    import java.awt.image.*;
    import java.applet.*;
    /*<applet code="ImageCreation_applet" width=1200 height=400>
    </applet>*/
    public class ImageCreation_applet extends Applet implements ImageObserver
         //     Image image1;
              Image image2;
              String s="";
              String image_name="img2";
              public void init()
                        setBackground(Color.yellow);
         //               Canvas c=new Canvas();
         //               image1=c.createImage(40, 40);
                        image2=this.getImage(this.getDocumentBase());
              public void paint(Graphics g)
                   //     g.drawImage(image1, 50, 50, this);
                        g.drawImage(image2, 0, 0, this);
                        g.drawString(s, 300, 300);
              public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h)
                        if((flags & SOMEBITS) != 0)
                                  repaint(x, y, w, h);
                        else if((flags & ABORT) != 0)
                                  s="ERROR";
                                  repaint();
                        return (flags & (ALLBITS|ABORT)) == 0;
         } I am continuously getting the ERROR String.... PLEASE HELP

    troy.cos wrote:
    i dont have enough time to look closer right now, but im pretty sure that:
    flags & ABORTneeds to be two & not one... so like:
    flags && ABORT
    Nope, that isn't the problem here. & is the correct one to use.
    "&" in this case is a bitwise and, while "&&" would be the boolean shortcut and, which does an entirely different thing.

  • I have a basic applet method timing problem with Firefox (and Chrome), not IE nor Opera. Works if JavaScript issues windows.alert() prior, fails otherwise.

    I have an applet method, which is invoked from a JavaScript function, that is triggered by the window.onload event. The problem seems to center in the loading of the applet and its methods.
    If I step through the 3 applet acceptance prompts (I chose to use a down-level Java), the applet method is never invoked, nor is an exception raised. How this happens is beyond my understanding.
    As additional information, the Init(), start(), and "desired" Java methods all use the synchronized keyword. This is an attempt to minimize the exposure to a multi-thread environment.
    If I issue a message from JavaScript (via window.alert()) PRIOR to invoking the method, I can get the desired results in special circumstances:
    1) When the alert is presented, Firefox also prompts, SIMULTANEOUSLY, to block/continue the applet (the first of the 3 applet acceptance prompts). I can accept that these are separate threads.
    2a) If I walk through the 3 applet acceptance prompts FIRST, and then hit the OK button on the alert message SECOND, I get the desired results, my applet method executes, and all is well (other than the fact that I would prefer not to have the alert in place at all).
    2b) If I hit the OK button on the alert message FIRST, and then walk through the 3 applet acceptance prompts SECOND, I get the same results as when the page loads WITHOUT the alert, which is the applet method is never invoked, nor is an exception raised. Weird, huh?
    The above problem only occurs when the browser and the applet's URL are loaded for the first time.
    Subsequent invocations (after the page & applet has been loaded initially) do not have the failing symptoms.
    It is my understanding that IE and Firefox (and Chrome and Opera, for that matter) each use the same implementation of JavaScript provided by Microsoft. Please correct me if this information is inaccurate.
    The failing page and it's applet are proprietary; I cannot provide the Internet URL, nor the Java or JavaScript source, to aid in your analysis.

    I can speak to the source code, but have no access to it.
    The current process/thread that invokes an applet method must check to see that the applet is not currently being loaded by another process/thread. If it is being loaded, the current process/thread should block until the load is complete, THEN attempt to invoke the applet method.
    Please forward my concern to a knowledgable developer. The nature of the problem, once identified, can be addressed in a very straightforward manner.

  • Applet.getImage() but so sloooooowly...

    I've seen a couple of questions posted about this issue, but no resolution. Essentially, performance of Applet().getImage() is unacceptably slow. It happens on my machine, and others.
    I'm using PlugIn 1.3.1 in WinIE 5.5, and have the following simple JApplet:
    public class GoofyApplet extends JApplet
    public void init()
    Image img = getImage(getDocumentBase(), "goofy/mickey/rtb_down.jpg"); // a 4K .jpg
    JLabel lab = new JLabel("test", new ImageIcon(img), JLabel.CENTER);
    Container content = getContentPane();
    content.add(lab);
    validate();
    repaint();
    I run that, and have ample time to curse and fume. About 20-50 seconds.
    Note the docs for getImage:
    "This method always returns immediately, whether or not the image exists. When this applet attempts to draw the image on the screen, the data will be loaded. The graphics primitives that draw the image will incrementally paint on the screen."
    First of all, timing tests have shown that this definition of "immediately" is pretty flexible. In my last test, getImage took 38230 ms.
    I've been cruising around the Forums, looking for an answer to this question and have yet to find it. This is disturbing--I can't believe SUN would ship the plug-in with this kind of behavior--but does this mean there is no solution?
    Cheers,
    Jon

    You need to wait for the image to load in an applet. If you use the Swing version of ImageIcon it will do this automatically for you. Else, use the following methods:
    * Loads an image as a resource.
    * Note:  With Swing, could use ImageIcon instead of createImage()/MediaTracker.
    public Image loadImage(String imageName) {
       Image image = null;
       URL url = getClass().getResource(imageName);
       try {
          image = createImage((ImageProducer) url.getContent());
          if (image==null) throw new Exception();
          waitForImageToLoad(this,image);
       } catch (Exception e) {
          System.out.println("unable to load image: "+imageName);
       }//end try
       return image;
    }//end loadImage
    * wait for an image to completely load. Use in an applet.
    public static void waitForImageToLoad(Component component, Image image) {
       MediaTracker tracker = new MediaTracker(component);
       try {
          tracker.addImage(image, 0);
          tracker.waitForID(0);
       } catch (InterruptedException e) {
          //this should not occur
          e.printStackTrace();
       }//end try
    }//end waitForImageToLoad

  • HT3281 Podcasts from Current Tv, since three weeks prior to the Nov 2012 election have had a url problem and cannot be played on my mac mini 2011 with 10.8.2 and the latest Itunes? anyone know why ? I am in contact with Itunes now and they wanted screensh

    Podcasts from Current Tv, since three weeks prior to the Nov 2012 election have had a url problem and cannot be played on my mac mini 2011 with 10.8.2 and the latest Itunes? anyone know why> ? I am in contact with Itunes now and they wanted screenshots of the problem, I can get these current tv episodes with a vpn and my isp says they are not blocking them, but i was surprised that prior to the election they were blocked, ?
    I also can get them on my Android Samsung Galaxy note 2 with no problem but on the Macmini cannot>/? I Unsubscribed and subscribed many times but still no luck, any ideas? I am waiting for the senior advisor to get back to me on this issue. I am in THailand now where the problem is happening and as I said the ISP says they do not block any podcasts.I also do not want it on my iphone 5, so I have to wait and see why the mac mini is not getting it.

    I seem to have fixed it by putting <div  class="clearfloat"></div> after the navigation bar?

  • Web Applet using URL type not appearing as desired

    Have created a web applet using URL type (for google maps). Although it works fine, the appearance is not acceptable. It is very elongated and appears to be in an unacceptable size/dimension for users.
    Does anybody know a way to configure the size? Any suggestions ??
    Thanks.

    Hi,
    here it goes
    well skipping my sleep did find me some solution for your query :) see if it help
    use the below code inside the applet for TYPE as HTML under Web Applet HTML.
    You can find details about the below script from Google Maps API Section.
    Currently I have only configured Ship to country field but you can add the more field accordingly.
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false" type="text/javascript"></script>
    <script type="text/javascript">
    var shipTo='%%%Ship_To_COUNTRY_Country%%%';
    var geocoder = null;
    var map = null;
    document.onreadystatechange=function() {
    if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(37.4419, -122.1419), 13);
         if(shipTo!=''){
              geocoder = new GClientGeocoder();
              showAddress(shipTo);
    map.setUIToDefault();
    function showAddress(address) {
    if (geocoder) {
         geocoder.getLatLng(address,function(point) {
              if (!point) {
                   alert(address + " not found");
              } else {
                   map.setCenter(point, 13);
                   var marker = new GMarker(point);
                   map.addOverlay(marker);
                   marker.openInfoWindowHtml(address);
    </script>
    ]div id="map_canvas" style="width: 500px; height: 300px"></div]
    Note:Above line < was replaced by ] due to issue with forum rendering
    The only Issue I came across with this Code is it doesn't work on FireFox, well as always Cross Browser Issue....
    Good nite :)
    Regards,
    Deepak H Andeli
    Edited by: Deepak H Andeli on Jan 29, 2010 12:19 AM

  • Url problem??

    Hi!
    I wanna know that what i should use to handle the url problem
    like if there is a url
    http://localhost:8080/myserver/mydir/home.jsp // mydir is physical dir
    http://localhost:8080/myserver/mydir2/home.jsp
    http://localhost:8080/myserver/mydir4/home.jsp
    http://localhost:8080/myserver/mydir/index.html
    how i can mapp more then one files regardles of only index.html file how i can map a ruquest to them like if user just enter
    http://localhost:8080/myserver/mydir/
    home.jsp should be shoown to him.
    Waiting for reply.
    Bye.

    This has to do with webserver configuration, which one are you using?

  • Problem with getImage/URL

    I hosted a picture on tinypic.com and now, I need to make it an URL so I can use the getImage method in Applet.
    When I try to do this:
    URL url = new URL("http://tinypic.com/blablabla.gif");
    I get this error when I run the applet:
    exception : java.security.AccessControlException : access denied (java.net.SocketPermission tinypic.com resolve).
    How do I solve this?

    i mean:
    a.jar
    inside it
    a.class
    b.gpeg
    and inside a.class:
    this.getImage("/b.jpeg");
    but i misunderstood.
    why you used URL i= new URL("img");
    i think if you are to get image do like this:
    Image img= this.getImage("img.jpeg");
    am i right?

  • Load a second video into an applet: resize - stretch problem

    Hello!
    I have an applet that loads a movie (call it film_a.mov). The size of the movie is 320 x 240. Since I want to show it bigger, I use a BorderLayout that stretches the video depending on the size given by
    the applet. In my case I set the applet parameter to "<applet code=Simple.class width=640 height=510>". Anyway, this display area is bigger than the actuell video size, so the video will be stretched.
    Everytime a user clicks with the mouse pointer onto the video area the second movie (call it film_b.mov) replace the first movie. The setup for the BorderLayout has not be chance. I close the player before loading the second movie with a function called loadNewMovie(). I even call this.removeAll(), player.close() and player.removeControllerListener(this).
    The problem is that if the second movie is loaded and placed into the vido display area it is not alway stretched to the possible BorderLayout.CENTER area. Sometimes it is stretched sometimes it is not streched. I really do not understand such behavior. It seems to me that I forget to call a update function that tells to stretch alway any video displayed.
    Both movies have the same size. I tried to solve this problem by using setSize, setBounds, etc. on the visualComponent but this does not solve the problem. If you want to try out, here come the code:
    mport java.applet.Applet;
    import java.awt.*;
    import java.lang.String;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.io.IOException;
    import javax.media.*;
    // import com.sun.media.util.JMFSecurity;
    * This is a Java Applet that demonstrates how to create a simple media player
    * with a media event listener. It will play the media clip right away and
    * continuously loop.
    * <applet code=Simple.class width=640 height=510> <param
    * name=file1 value="auto.mov"> <param name=file2 value="hongkong.mov">
    public class Simple extends Applet implements ControllerListener {
         private static final long serialVersionUID = 1L;
         // media Player
         Player player = null;
         // component in which video is playing
         Component visualComponent = null;
         // controls gain, position, start, stop
         Component controlComponent = null;
         // displays progress during download
         Component progressBar = null;
         boolean firstTime = true;
         long CachingSize = 0L;
         int controlPanelHeight = 0;
         int videoWidth = 0;
         int videoHeight = 0;
         MediaLocator mrl = null;
         String mediaFile1 = null;
         String mediaFile2 = null;
         boolean closed = false;
          * Read the applet file parameter and create the media player.
         public void init() {
              // $ System.out.println("Applet.init() is called");
              setLayout(new BorderLayout());
              setBackground(Color.red);
              if ((mediaFile1 = getParameter("FILE1")) == null)
                   Fatal("Invalid media file parameter");
              if ((mediaFile2 = getParameter("FILE2")) == null)
                   Fatal("Invalid media file parameter");
          * Start media file playback. This function is called the first time that
          * the Applet runs and every time the user re-enters the page.
         public void start() {
              // $ System.out.println("Applet.start() is called");
              // Call start() to prefetch and start the player.
              getMedia(mediaFile1);
              if (player != null)
                   player.start();
              setVisible(true);
          * Stop media file playback and release resource before leaving the page.
         public void stop() {
              // $ System.out.println("Applet.stop() is called");
              if (player != null) {
                   player.stop();
                   player.deallocate();
         public void destroy() {
              // $ System.out.println("Applet.destroy() is called");
              player.close();
         public void getMedia(String mediaFile) {
              URL url = null;
              try {
                   url = new URL(getDocumentBase(), mediaFile);
                   mediaFile = url.toExternalForm();
              } catch (MalformedURLException mue) {
              try {
                   // Create a media locator from the file name
                   if ((mrl = new MediaLocator(mediaFile)) == null)
                        Fatal("Can't build URL for " + mediaFile);
                   // Create an instance of a player for this media
                   try {
                        player = Manager.createPlayer(mrl);
                   } catch (NoPlayerException e) {
                        System.out.println(e);
                        Fatal("Could not create player for " + mrl);
                   // Add ourselves as a listener for a player's events
                   player.addControllerListener(this);
              } catch (MalformedURLException e) {
                   Fatal("Invalid media file URL!");
              } catch (IOException e) {
                   Fatal("IO exception creating player for " + mrl);
          * This controllerUpdate function must be defined in order to implement a
          * ControllerListener interface. This function will be called whenever there
          * is a media event
         public synchronized void controllerUpdate(ControllerEvent event) {
              // If we're getting messages from a dead player,
              // just leave
              if (player == null)
                   return;
              // When the player is Realized, get the visual
              // and control components and add them to the Applet
              if (event instanceof RealizeCompleteEvent) {
                   if (progressBar != null) {
                        remove(progressBar);
                        progressBar = null;
                   if ((controlComponent = player.getControlPanelComponent()) != null) {
                        controlPanelHeight = controlComponent.getPreferredSize().height;
                        add(BorderLayout.SOUTH, controlComponent);
                        validate();
                   if ((visualComponent = player.getVisualComponent()) != null) {
                        add(BorderLayout.CENTER, visualComponent);
                        validate();
                        visualComponent
                                  .addMouseListener(new java.awt.event.MouseAdapter() {
                                       public void mousePressed(
                                                 java.awt.event.MouseEvent evt) {
                                            System.out
                                                      .println("MovieStreaming: mousePressed");
                                            loadNewMovie(mediaFile2);
                                       public void mouseReleased(
                                                 java.awt.event.MouseEvent evt) {
                                       public void mouseEntered(
                                                 java.awt.event.MouseEvent evt) {
                                       public void mouseExited(
                                                 java.awt.event.MouseEvent evt) {
              } else if (event instanceof CachingControlEvent) {
                   if (player.getState() > Controller.Realizing)
                        return;
                   // Put a progress bar up when downloading starts,
                   // take it down when downloading ends.
                   CachingControlEvent e = (CachingControlEvent) event;
                   CachingControl cc = e.getCachingControl();
                   // Add the bar if not already there ...
                   if (progressBar == null) {
                        if ((progressBar = cc.getControlComponent()) != null) {
                             add(progressBar);
                             setSize(progressBar.getPreferredSize());
                             validate();
              } else if (event instanceof EndOfMediaEvent) {
                   // We've reached the end of the media; rewind and
                   // start over
                   player.setMediaTime(new Time(0));
                   player.start();
              } else if (event instanceof ControllerErrorEvent) {
                   // Tell TypicalPlayerApplet.start() to call it a day
                   player = null;
                   Fatal(((ControllerErrorEvent) event).getMessage());
              } else if (event instanceof ControllerClosedEvent) {
                   closed = true;
         public void closePlayer() {
              synchronized (this) {
                   player.close();
                   while (!closed) {
                        try {
                             wait(100);
                        } catch (InterruptedException ie) {
                   player.removeControllerListener(this);
                   System.out.println("player is shutdown");
                   closed = false;
         public void loadNewMovie(String mediaFile) {
              // remove all components
              closePlayer();
              removeAll();
              getMedia(mediaFile);
              if (player != null)
                   player.start();
              setVisible(true);
         void Fatal(String s) {
              // Applications will make various choices about what
              // to do here. We print a message
              System.err.println("FATAL ERROR: " + s);
              throw new Error(s); // Invoke the uncaught exception
              // handler System.exit() is another
              // choice.
    }As you may notice this code is basicly the SimplePlayerApplet example which I modified a bit.
    Thank you for your Help
    Matt2

    Sorry,
    Can you tell me how do you solve it because I have got the same problem.
    Can you indicate me the topic where did you find solution.
    Thank in advance.

  • Java Applet Background Color Problem on Internet Explorer

    Hi,
    Please check out the following URL:
    http://www.utopiainteractive.com/clients/AkonFinal/glossary.htm
    The menu bar is writting in Java Applet. If you scroll down the page, and scroll back up, I see white background as I scroll back up. It happens only on Internet explorer. Neither Java Applet nor HTML Body bg color is white. I am kinda lost, and any help would really be appreciated.
    Thank you and look forward to hearing from someone soon.
    Sachin

    Hi,
    Well I used HtmlConver utility to generate applet html code, so I assume nothing is wrong with Object tag. Do you know what could cause this problem on Internet explorer? To be honest, I spent last couple of days, but I am just lost. It absolutely works fine on Netscape.
    Thanks,
    Sachin

  • Applet-Servlet Communication problem EOFException

    Hi! i´ve been searching and searching through forums because it seems this problem is very common, but none of the solutions i´ve seen so far suits me, so i´m here looking for some help because i´ve been stuck one week with this. First of all sorry if my english isn´t the best... i´m a bit rusty...
    Well, i had some code that worked perfectly, but i needed to perform some changes because i needed the servlet to send more info to the applet, and here started the problems, when i made the changes it started to throw EOFException when i was trying to read the InputStream, and furthermore when i came back to the original code it started to throw the exception in the same place too
    So here i am... don´t know what to do now and i entrust to you to give me some tips.
    Here comes some code. This is the original code, the one that runned but it doesn´t run right now
    Applet:
    public ListasComponentesSeleccionables cargarListasComponentes( ) throws IOException, ClassNotFoundException {
              String serv = "/Desaladora/cargarListasComponentesApplet.do";
              String host = Principal.documentBase.getHost( );
              URL direccion = new URL( "http", host, 8080, serv );
              // Create conection
              URLConnection connection = direccion.openConnection( );
              connection.setDoInput( true ); 
              connection.setDoOutput( true );
              connection.setUseCaches( false );
              connection.setRequestProperty( "Content-Type", "application/x-java-serialized-object" );
              ObjectOutputStream output;
              output = new ObjectOutputStream( connection.getOutputStream( ) );
              output.writeObject( new Boolean(true) );
              output.flush( );
              output.close( );
              ObjectInputStream input = new ObjectInputStream( connection.getInputStream( ) ); //<-- Here is the problem
              ListasComponentesSeleccionables response = new ListasComponentesSeleccionables( );
              response = ( ListasComponentesSeleccionables ) input.readObject( );
              return response;
         }Servlet:
    ublic class CargarListasComponentesAppletAction extends Action {
    public ActionForward execute(     ActionMapping mapping,
                                                     ActionForm form,
                                                     HttpServletRequest request,
                                                     HttpServletResponse response )
                            throws ServletException, IOException, Exception  {
              InitialContext context = new InitialContext();
              SensorManagerService sensor_service;
              ActuatorManagerService actuator_service;
              Globals.LOGGER_SECURITY.debug( "Entering ACTION 'CargarListasComponentesAppletAction'" );
              response.setContentType("application/x-java-serialized-object");
              try
                   ObjectInputStream bufferentrada = new ObjectInputStream(request.getInputStream());
                   Boolean peticionOK = (Boolean)bufferentrada.readObject();
                   ObjectOutputStream buffersalida = new ObjectOutputStream(response.getOutputStream());
                   sensor_service = ( SensorManagerService ) context.lookup( "desaladora/SensorManagerServiceBean/local" );
                   ArrayList<AlarmConnectedSensorDTO> sensorList = sensor_service.findAllSensorsToAlarms();
                   actuator_service = ( ActuatorManagerService ) context.lookup( "desaladora/ActuatorManagerServiceBean/local" );
                   ArrayList<AlarmConnectedActuatorDTO> actuatorList = actuator_service.findAllActuatorsToAlarms();
                   buffersalida.writeObject( crearListasSeleccionables(sensorList, actuatorList) );
                   buffersalida.flush();
              catch(Exception e)
                   System.out.println("Error en la trasmision de datos");
              return null;
         private ListasComponentesSeleccionables crearListasSeleccionables(ArrayList<AlarmConnectedSensorDTO> sensorList,
                    ArrayList<AlarmConnectedActuatorDTO> actuatorList) {
              Vector<Integer> vectorSensores = new Vector<Integer>();
              Vector<Integer> vectorActuadores = new Vector<Integer>();
              for(AlarmConnectedSensorDTO sensor : sensorList) {
                   vectorSensores.add(sensor.getIdSensor( ));
              for(AlarmConnectedActuatorDTO actuator : actuatorList) {
                   vectorActuadores.add(actuator.getIdActuator( ));
              ListasComponentesSeleccionables listasComponentesSeleccionables =
                                  new ListasComponentesSeleccionables(vectorSensores, vectorActuadores);
              return listasComponentesSeleccionables;
    }i´ve been running some test in another computer, and this code simply works, but it doesn´t work in the machine i usually work.
    Maybe someway the stream get corrupt? the info i´ve been trying to send and started throwing the exception may still be in the stream? I don´t know what to think right now.
    Hope someone has any idea, thankyou.

    I dont see the problem. However, I suggest you change this;
    System.out.println("Error en la trasmision de datos"); t
    to e.printStackTrace() to see what it is doing when it stops working.
    I also suggest peppering your code with System.out.println() statements to see what it is doing just before stopping.
    Also, try your code with a brand new file with only a few characters in it. If it works, add to it some of your originial file content until it stops working. This way, you can determine if its the file size that is causing the crash or something in the file content. If all else fails, study java I/O and try some other way to read/write the file. You can also try a different browser. If it works, its the browser. Still having problems? Create a new project with a simple applet and file read/write program and get that working. That way, all the other stuff in your original project isn't in the way.

  • URL problem with Java Plugin 1.4.1

    To whom it may concern:
    We are developers working in java and we are experiencing a problem with the new Java plug-in (version 1.4.0) that are not able to solve ourselves:
    We have an applet that needs to read URL�s. When we run the applet locally, this URL is:
    "file:/C:/proof/hunter%20media/images/classic.ski". When we try to open an stream to this URL it doesn't work. The message that we obtain is:
    access denied (java.io.FilePermission C:\proof\hunter media\images\classic.ski read)
    but all the permissions are OK. Also, if we remove the whitespace from URL the applet works OK.
    We have tested the applet in Windows XP with Netscape 7.0, Internet Explorer 6.0.2 and tha Java plugin version is 1.4.0.
    Is there any problem with the whitespaces in URL opened locally?
    Please advice,
    Kind regards,
    Fernando

    Doesn't a url require "file://....?

  • URL problem with Java plugin 1.4.0

    To whom it may concern:
    We are developers working in java and we are experiencing a problem with the new Java plug-in (version 1.4.0) that are not able to solve ourselves:
    We have an applet that needs to read URL�s. When we run the applet locally, this URL is:
    "file:/C:/proof/hunter%20media/images/classic.ski". When we try to open an stream to this URL it doesn't work. The message that we obtain is:
    access denied (java.io.FilePermission C:\proof\hunter media\images\classic.ski read)
    but all the permissions are OK. Also, if we remove the whitespace from URL the applet works OK.
    We have tested the applet in Windows XP with Netscape 7.0, Internet Explorer 6.0.2 and tha Java plugin version is 1.4.0.
    Is there any problem with the whitespaces in URL opened locally?
    Please advice,
    Kind regards,
    Fernando

    Hi Fernando,
    What do you mean u removed the whitespaces. I am actually trying to work my way around a similar problem. I am trying to access a URL from a locally loaded applet. But i get a security exception too.
    http://osmv.soe.umich.edu/blueskies/kgs99/kgs99.txt
    how do i strip it of whitespace?
    Thanks,
    Shantanu

  • Applet - with URL

    I wanted this applet to load a table, and then displays it. The load logic is not handled. Note that I could not get the load logic in the init() method because it has a mandatory throw. So I made up a name "myinit()" for the load method. I have tried to handle it within the paint method with an instaniation or constructor, but I was never able to code it properly.
    How can I get this load logic to be handled?
    import java.applet.Applet;
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    import java.net.*;
    public class urla extends java.applet.Applet
      int par;
      String par1;
      int i = 1;
      int j = 20;
      int m = 0;
      int k = 0;
      String arr[] = new String[1000];
      String inputLine;
      public void myinit() throws MalformedURLException, java.io.IOException
         URL mysite = new URL("http://www.xxxxxxxxx.html");
         try
             String parameter = getParameter("par1");
             if (parameter != null)
                 par = Integer.parseInt(parameter);
             else
                 par = 99;
                 k++;
             URLConnection ms = mysite.openConnection();
             BufferedReader in = new BufferedReader(
                                 new InputStreamReader(
                                 ms.getInputStream()));
             while ((inputLine = in.readLine()) != null)
                 arr[m] = inputLine;
                 m++;
             in.close();
         catch (MalformedURLException e)
           k++;
        public void paint(Graphics screen)
           screen.drawString("THE FOLLOWING HAVE ADDED THEIR BIOS:",5 ,15);
    //                  while (i < 21)
    //                    j = j + 20;
                        screen.drawString("output -  "  + arr[0], 35, 40) ;
                        screen.drawString("output -  "  + arr[1], 35, 60) ;
                        screen.drawString("output -  "  + arr[2], 35, 80) ;
                        screen.drawString("output -  "  + par, 35, 100) ;
    //                    + arr, 35, j);
    // i++ ;
    // repaint() ;
    // repaint() ;

    Thank you for the reply.
    1. Because I am not familiar with a jappletMy first and most important recommendation is that you become familiar with JApplets before using them. You cannot learn Java by trial and error coding. It just leaves you confused. Go the the tutorials on Applets and go through them. There is no other way other than study.
    2. I want the load logic as the init method.
    However, the load table logic will not work in the
    init. (because of the throw)Please read and study the tutorials on exception handling in java. You are letting a non existant problem stop you. Your solution is to catch the exception and handle it in your JApplet. Read on how to do this either from a good book or the tutorials.
    . Forget the display logic. It is now just some
    test logic to help me debug the applet e. g. the hard
    coded displays told me that the load logic was never
    handled.
    Can I force the handle of the "myinit" method in the
    "paint" method? If so, how. I sure cannot get that
    to work.I am 98% sure that you do not want to mess with the JApplet?s paint method. There are so many easier and safer methods of displaying data in a japplet. Again, please study the tutorials before you go blindly stumbling through this.
    You are correct, I am new to java.And with study, you should do well. Good luck.
    Pete

Maybe you are looking for

  • Why did my iPod stop working?

    My new fifth gen ipod is barely a few weeks old and already is having trouble. Previously it wouldn't turn on, and resetting it worked, but now the same thing is happening but without anything working. I tried the five R's and EVERYTHING else the app

  • Installing Photoshop Elements 1.01 on Windows 8

    To Whom it May Concern, I'm trying to install Photoshop Elements 1.01 on Windows 8, but the system won't let me. Please let me know how i can install this version.  Thank you. RON

  • Old deleted Podcasts still being listed?

    Hi, I have a pretty annoying issue with deleted podcasts: I usually have a save and sound way of getting rid of old podcasts: After they are being played, they get deleted automatically with the next refresh (standard settings). However, I have about

  • How can I Calcualte the geometric mean in oracle 10g

    dear all plz I need a function to calculate the geometric mean I uses oracle 10g thanks in advance

  • A few questions about OpenGl acceleration

    My system: Vista Ultimate 32bit, Intel Q6600, Geforce 8600GT/512MB, 4G Ram, newest card driver. 1. Do the graphics driver setting have any influence on Photoshop? If yes, what are the recommended settings? 2. Flick panning is stuttering a bit. Is my