Applet - jar_cache.tmp problem

Hi, i have problem with storing many jar_cache.tmp files in my temp directories.
Those files are storing in temp directory every time when i start my applet or work with him.
When I close my applet jar_cache.tmp files are staying in tmp directory. So, after a few days work with applet, I have a few thousands jar_cache files in /temp.
I read that was similar bug in previous versions of java, but i use java 1.6...
Can somebody please help me?
Thanks in advance!

Yes, that's true. But, is normal that java caching so many files in temp files anf doesn't delete them?
I have example where is, after six months of using applet, in temp directory been stored about 100000 jar_cache.tmp files....
Why java store tmp files in temp directory? I set directory for storing java temporary files to ...\Application Data\Sun\Java\jdk1.6.0_17\cache

Similar Messages

  • Applet default directory problem

    Hi,
    I have a directory problem when my applet write a file on client box (permissions OK),
    the directory is always the window desktop!!!!
    Is there a method to change the default directory??
    Thanks for your time,
    JC2001

    Hi,
    Applets loaded into a Java-enabled browser can't write files.
    Sun's appletviewer allows applets to write files that are named on the
    access control list for writing. The access control list for writing is
    empty by default.
    You can allow applets to write to your /tmp directory by setting the
    acl.write property in your ~/.hotjava/properties file:
    acl.write=/tmp
    You can allow applets to write to a particular file by naming it
    explicitly:
    acl.write=/home/me/somedir/somefile
    Use : to separate entries:
    acl.write=/tmp:/home/me/somedir/somefile
    Bear in mind that if you open up your file system for writing by
    applets, there is no way to limit the amount of disk space an applet
    might use.
    I hope this will help you.
    Thanks
    Bakrudeen

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

  • Multiple instances of the same applet loaded causes problem

    I have a java applet that has several classes in the project. The applet has a JTable a JButton and a JLabel control. The applet is displayed within an HTML page. The problem is that if a user opens the same html page more than once with the applet in it, only the last applet loaded receives the screen updates.
    For example in one senario. I have an error message that displays in the Label control once they click on the button.
    The user opens the html page and the applet is loaded (window 1). The user then opens the same html page again (window 2) with window 1 still open. If the user clicks on the Button in window 1, the error message is displayed in the window 2 applet.
    Originally I had some static variables. Thinking it was being used globally by the JVM so I removed all of them and it still happens. I have tried using both the Applet and Object tag. But it still happens.
    Has anyone experienced this before? Any suggestions on how to make the applet update the instance that recieved the events and not just the last one that was loaded?

    You need to look at applet classloader issues. If applets have the same archive list and come from the same codebase, they have the same classloader. A class is namespaced by it's class + classloader. Any statics in a class with a classloader will be shared. If you instead make it such that your applets have unique classloaders (which you can't change for unsigned applets by yourself) by changing the codebase, that would be one solution.
    For other solutions, I recommend searching the forum. This issue comes up a lot.

  • 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

  • Java Applet call javascript problem

    Hi I have a web page as follow and embedded a applet. The applet call the java script, and instead of showing an alarm, the browser show the javascript code. Is that strange ? Any suggestion for this problem.
    HTML:
    ================================================================
    <HTML>
         <HEAD>
         function ShowEmbd()
              alert("Test Applet call Javascript");
         </SCRIPT>
         </HEAD>
         <BODY>
         <FORM NAME="AppletEmbdStart">
              <OBJECT classid="clsid:48B2DD7B-6B52-4DB0-97C9-ECB940113B47" id="CIVON_DEmbdObj" width="0" height="0"></OBJECT>
              <APPLET code="MyApplet.class" width="0" height="0"></APPLET>
         </FORM>
         </BODY>
    </HTML>MyApplet.java
    =========================================================================
    import netscape.javascript.*;
    public class MyApplet extends javax.swing.JApplet
         private JSObject m_win = null;
         private JSObject m_doc = null;
         public void init()
              getJSWin().call("ShowEmbd", null);
         private getJSDoc()
              if(m_doc == bull)
                   m_doc = (JSObject) getJSWin().getMember("document");
              return m_doc;
         private JSObject getJSWin()
              if (m_win == null)
                   m_win = netscape.javascript.JSObject.getWindow(this);
              return m_win;
    }The page was load and it should call the applet MyApplet. The MyApplet should do the init() method and call the Javascript "ShowEmbd()", BUT, instead of show alert from ShowEmbd(), the browser show the code of ShowEmbd() itself ...... It did not run the javascript and shows the alert ??
    The browser shows a message from status bar "The applet not initial" ???? why ???
    Can anyone help ?!

    On first look:
    I am not sure about the Object Tag, but the Applet Tag requires the MAYSCRIPT attribute before Java can call Javascript.

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

  • Please Urgent sound applet in jsp problem

    Hi please any body hekp me urgently.
    I have a problem while playing a sound applet in the jsp file the error is class not found.
    My applet class file is in the com.mypack.common
    its code is
    public class PlayErrorSoundApplet extends Applet
    public PlayErrorSoundApplet()
    public void init()
    public void playSound()
    String soundObj = getParameter("soundObj");
    AudioClip sound = getAudioClip(getDocumentBase(), "success.wav");
    sound.play();
    in the jsp i have written the code like this
    <applet codebase="com.mypack.common" code="PlayErrorSoundApplet.class" name="soundApplet" width="0" height="0">
    <param name="soundObj" value="error.wav">
    </applet>
    In the applet console i got class not found error.
    please help me .....advanced thanks......

    actually, codbase is a directory. so
    <applet codebase="com/mypack/common" code="PlayErrorSoundApplet.class" name="soundApplet" width="0" height="0">
    <param name="soundObj" value="error.wav">
    </applet>this means you have something like
    pacakge com.mypack.common
    public class PlayErrorSoundApplet {
    Make sure to put the html file in the root directory of the package structure
    /myhtmlfile.html
       /com
          /mypack
               /common
                    PlayErrorSoundApplet.class                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Swing Applet in JSP: problem with fetching data from database

    i am facing a problem while fetching data from database using Swing Applet plugged in a JSP page.
    // necessary import statements
    public class NewJApplet extends javax.swing.JApplet {
    private JLabel jlblNewTitle;
    private Vector vec;
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    NewJApplet inst = new NewJApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    public NewJApplet() {
    super();
    initGUI();
    private void initGUI() {
    try {
    this.setSize(542, 701);
    this.getContentPane().setLayout(null);
    jlblTitle = new JLabel();
    this.getContentPane().add(jlblTitle);
    jlblTitle.setText("TITLE");
    jlblTitle.setBounds(197, 16, 117, 30);
    jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
    jlblNewTitle = new JLabel();
    this.getContentPane().add(jlblNewTitle);
    Vector vecTemp = getDBDatum(); // data fetched fm DB r stored here.
    jlblNewTitle.setText(vecTemp.get(1).toString());
    jlblNewTitle.setBounds(350, 16, 117, 30);
    jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));
    } catch (Exception e) {
    e.printStackTrace();
    }//end of initGUI()
    private Vector getDBDatum() {
    // fetches datum from oracle database and stores it in a vector
    return lvecData;
    }//end of getDBDatum()
    }//end of class
    in index.jsp page i have included the following code for calling this applet:
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
    width="600" height="300">
    <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>
    if i view it in using AppletViewer it runs perfectly and display the data in JLabel. (ie, both jlblTitle and jlblNewTitle).(ie, DATA FETCHES FROM db AND DISPLAYS PROPERLY)
    BUT IF I CLICK ON INDEX.JSP, ONLY jlblTitle APPEARS. jlblnNewTitle WILL BE BLANK(this label name is supposed to fetch from database)
    EVERY THING IS DISPAYING PROPERLY EXCEPT DATA FROM DATABASE!!!
    i signed the applet as follows :
    grant {
    permission java.security.AllPermission;
    Can any body help me to figure out the problem?

    This is the Swing Applet java code
    import java.awt.Dimension;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTree;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingConstants;
    public class HaiApplet extends javax.swing.JApplet {
         private JLabel     jlblTitle;
         private JLabel     jlblNewTitle;
         private Vector     vec;
         * main method to display this
         * JApplet inside a new JFrame.
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              NewJApplet inst = new NewJApplet();
              frame.getContentPane().add(inst);
              ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
              frame.pack();
              frame.setVisible(true);
         public HaiApplet() {
              super();
              initGUI();
         private void initGUI() {
              try {               
                   this.setSize(542, 701);
                   this.getContentPane().setLayout(null);
                        jlblTitle = new JLabel();
                        this.getContentPane().add(jlblTitle);
                        jlblTitle.setText("OMMS");
                        jlblTitle.setBounds(197, 16, 117, 30);
                        jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
                        jlblTitle.setHorizontalAlignment(SwingConstants.CENTER);
                        jlblTitle.setForeground(new java.awt.Color(0,128,192));
                        jlblNewTitle = new JLabel();
                        this.getContentPane().add(jlblNewTitle);
                        Vector vecTemp = getDBDatum();
                        jlblNewTitle.setText(vecTemp.get(1).toString());
                        jlblNewTitle.setBounds(350, 16, 117, 30);
                        jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));     
              } catch (Exception e) {
                   e.printStackTrace();
         }//end of initGUI()
         private Vector getDBDatum() {
              Vector lvecData = new Vector(10,5);
              Connection lcon = null;
              Statement lstmt = null;
              ResultSet lrsResults = null;
              String lstrSQL = null;
              String lstrOut = null;
              try {
                   OmmsDBConnect db = new OmmsDBConnect();
                   lcon = db.connectDb();
                   lstmt = lcon.createStatement(lrsResults.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   lstrSQL = "select DT_ID from P_DATATABLES";
                   lrsResults = lstmt.executeQuery(lstrSQL);        
                   int i = 0;
                   lrsResults.last();
                   int length = lrsResults.getRow();
                   System.out.println(length);
                   lrsResults.beforeFirst();
                   int recCount = 0;
                   while (lrsResults.next()) {
                        recCount++;
                        lvecData.addElement(new String(lrsResults.getString("DT_ID")));
                   //     System.out.println("ID :  " + lrsResults.getString(1));
                        i++;
                   }System.out.println("here 3 out fm while");
              catch(SQLException e) {
                   System.out.print("SQLException: ");
                   System.out.println(e.getMessage());
              catch(Exception ex) {
                   lstrOut = "Exception Occured " + ex.getMessage();
              finally {
                   try {
                        lrsResults.close();
                        lstmt.close();
                        lcon.close();
                        System.out.println("[DONE]");
                   catch(Exception e) {
                        System.out.println(e);
             }//end of finally
              return lvecData;
         }//end of getDBDatum()
    }//end of classOfcourse the above code compiles and runs well. in Applet Viewer
    I plugged the above Swing Applet in a JSP page index.jsp
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
                   width="600" height="300">
         <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>Every thing is working fine in AppletViewer...But if i view this in any browser, then only the jlblTitle is displaying. jlblNewTitle is not displaying(this label name is actually fetching from thedatabase)
    can any body help me regarding this matter.? Thx in Advance.

  • Applet database access problems!

    Hi,
    I have a major problem. I'm trying to design an applet that can talk to a database server which is not the same server where the applet is hosted. I keep getting an exception like below: (note I changed my db server name)
    java.sql.SQLException: Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.net.SocketPermission aaaa.bbbbb.net resolve)
         at com.mysql.jdbc.Connection.createNewIO(Connection.
    help?

    Ok, I went back and re-read the answer to a similar question I asked earlier. Since I can't talk directly to the other db server, what is the work around?
    Make a php page that updates the database, then call that page from within the applet?

  • 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

  • Applet / Application Sound problem

    Hey everyone,
    I'm programming a game named None Left, and the main file (NoneLeft.java) contains a constructor :
    public class NoneLeft extends javax.swing.JApplet implements Runnable, ContextListenerIt also contains a main method:
        public static void main(String s[]) {
            JFrame f = new JFrame("NoneLeft");
            f.addWindowListener(new WindowAdapter() {
                public void windowClosing(WindowEvent e) {System.exit(0);}
            JApplet applet = new NoneLeft();
            f.getContentPane().add("Center", applet);
            applet.init()        f.pack();
            f.setSize(new Dimension(800,600));
            f.setVisible(true);
    AudioClip music;
    music = applet.getAudioClip(new URL("file:///K:/BinaryFinary2.wav"));
    music.loop();The problem is that whenever I try to use the applet's method getAudioClip,
    i get the following error:
    Exception in thread "main" java.lang.NullPointerException
            at java.applet.Applet.getAppletContext(Applet.java:187)
            at java.applet.Applet.getAudioClip(Applet.java:295)
            at noneleft.NoneLeft.main(NoneLeft.java:865)The code at line 865 is:
    music = applet.getAudioClip(new URL("file:///K:/BinaryFinary2.wav"));
    music.loop();The NullPointerException is really what has me puzzled. The applet is there: It's created in the public static void main method, but it just won't work. Anyone have a clue about why that is?
    I have a feeling it's because of the Applet inheritance and the application; it's not sure which one is which...or maybe not.
    Thanks so much!
    Edited by: simpavid on May 27, 2008 4:11 PM

    Thank you so much for your help so far;
    However, I still haven't gotten this to work.
    I now have the code:
    JFrame f = new JFrame("NoneLeft");
    JApplet applet = new NoneLeft();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(800,600));
    f.setVisible(true);
    AudioClip music = applet.getAudioClip(applet.getCodeBase(), "BinaryFinary.wav");
    music.loop();but my error still exists:
    Exception in thread "main" java.lang.NullPointerException
            at java.applet.Applet.getCodeBase(Applet.java:152)
            at noneleft.NoneLeft.main(NoneLeft.java:861)The strange part is that getAudioClip no longer gives me a null pointer but getCodeBase() does. I also tried getDocumentBase() and it gives me an error. I'm wondering if this has to do with the fact that this is called on an applet from a main method? The applet is instantiated as a NoneLeft object, which extends JApplet, so that shouldn't be the problem. Do you have a clue on how to fix that?
    Again, thanks so much for the help.

  • A strange applet selection fail problem

    Hi, All. I am trying to implement the RSA encryption and decryption using rmi. I use the RSA implementation sample code in the previous post and the RMIPurse sample code in the package (3.0.2 classic ) for testing. However, after I add some initialization codes into the PurseImpl class, I got the "applet selection failed" error.
    The code that I modified based on RMIPurse
    import javacard.framework.ISO7816;
    import javacard.framework.ISOException;
    import javacard.security.CryptoException;
    import javacard.security.KeyBuilder;
    import javacard.security.KeyPair;
    import javacard.security.RSAPrivateCrtKey;
    import javacard.security.RSAPublicKey;
    import javacardx.crypto.Cipher;
    public class PurseImpl extends CardRemoteObject implements Purse {
        private short balance = 0;
        private byte[] number;
         // crypto variables
         final static byte GETSET_CLA = (byte) 0x85;
         final static byte CRYPT_CLA = (byte) 0x00;
         // Instruction set for SimpleString
         final static byte SET = (byte) 0x10;
         final static byte GET = (byte) 0x20;
         final static byte SELECT = (byte) 0xA4;
         // This buffer contains the string data on the card
         byte TheBuffer[];
         // globals
         RSAPrivateCrtKey rsa_PrivateCrtKey;
         RSAPublicKey rsa_PublicKey;
         KeyPair rsa_KeyPair;
         Cipher cipherRSA;
         final short dataOffset = (short) ISO7816.OFFSET_CDATA;
        public PurseImpl() {
            super(); // export it
            number = new byte[5];
              // crypto
            TheBuffer = new byte[100];
            // generate own rsa_keypair
            try {
                   rsa_KeyPair = new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_1024);
                   rsa_KeyPair.genKeyPair();
                   rsa_PublicKey = (RSAPublicKey) rsa_KeyPair.getPublic();
                   rsa_PrivateCrtKey = (RSAPrivateCrtKey) rsa_KeyPair.getPrivate();
                   cipherRSA = Cipher.getInstance(Cipher.ALG_RSA_PKCS1, false);
              catch (CryptoException e) {
                short sw = (short) 0x9100;
                sw |= e.getReason();
                ISOException.throwIt(sw);
        }I got:
    Receiving initial reference... java.rmi.RemoteException: Applet selection failed, SW = 6d00
    That's strange. because without the initialization codes in try/catch block, there is no problem to select the applet. Can anyone help?

    I have exactly the same problem when calling (trying to) any applets method. Where are these parameters to be turned on?

  • Applet Socket permission problem

    Heloo I made an applet which gets the content of web . like if i pass the www.yahoo.com to applet it must read all the html coding of yahoo page .my code is perfect with the desktop application but when i run it with applet then it gives the socket permission error i search all where but i havent found any solution i tried to edit policy file but still found the same error kindly help me how to get rid from this error thanks and below is my code sample
    Applet code:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.*;
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.security.Permission;
    public class Apple extends JApplet implements ActionListener{
              Container c;
         JTextField uf=new JTextField(30);
         JTextArea tarea=new JTextArea(600,600);
         JButton b=new JButton("Get Content");
         JButton bb=new JButton("Clear");
         URL u;
         JScrollPane sp=new JScrollPane();
         InputStream is = null;
    DataInputStream dis;
    String s;
         public void init(){
              JOptionPane.showMessageDialog(null,"hello world");
              c=new Container();
                   JOptionPane.showMessageDialog(null,"Demo Product Developed By sarc");
              c=this.getContentPane();
              uf.setText("http://www.yahoo.com");
              c.setLayout(new FlowLayout(FlowLayout.LEFT));
              sp.add(tarea);
              c.add(new JLabel("Enter Your Url"));
              c.add(uf);
              c.add(b);     c.add(bb);
              c.add(new Label("EXAMPLE: http://www.rentacoder.com"));
              b.addActionListener(this);bb.addActionListener(this);
              c.add(tarea);     
         public void actionPerformed(ActionEvent ae){
              if( ae.getSource()==b){
                        JOptionPane.showMessageDialog(null,"Demo Product Developed By sarc");
              down();
              if( ae.getSource()==bb){
    tarea.setText("");
              public void down(){
                   try{
                   System.out.println("1");
                   String uu=uf.getText()+":80";
                   u = new URL(uf.getText());
                   is = u.openStream();
                   dis = new DataInputStream(new BufferedInputStream(is));
                   String str;int k=0;int l=50;
                   while ((s = dis.readLine()) != null) {
    tarea.append(s+"\n");
    k++;
    if(k==l){
         JOptionPane.showMessageDialog(null,"Demo Product Developed By sarc");
    l=2*k;
    }is.close();
    } catch (MalformedURLException e) {JOptionPane.showMessageDialog(null,"e"+e);
    } catch (IOException e) {JOptionPane.showMessageDialog(null,e);
    HTML CODE :
    <applet code="Apple.class" width="300" height="300">
    </applet>

    The applet should be able to connect to the host it came from but I think you
    have to connect to the same port as well (not really sure about that).
    You can either have the consumers of your applet set up a policy for your applet
    or you sign the applet.
    Signing applets:
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post and last post for the java class file
    http://forum.java.sun.com/thread.jsp?forum=63&thread=409341
    4th post explaining how to set up your own policy with your own keystore
    Java security configuration (according to me):
    1. Signing, good for Internet published applets. The user will be asked if he or she trusts
    the applet and when yes or allways is clicked the applet can do whatever it wants. This
    is the default setting of the SUN jre and can be compared with IE setting that askes the
    user about downloading and running ActiveX controls from the Internet security zone.
    2. Setting up a policy. Good for people who disabled asking the user about signed
    applets (like companies that are worried this could cause a problem). it is possible
    to provide multiple java.policy files in the java.security, a company could put a .policy file
    on the Intanet and have all jre's use this by adding this URL to the java.security.
    When a policy needs to be changed the admin only has to do this is the file on the
    Intranet.
    A specific user can have a policy in their user.home to set up personal policies (to be
    done by Administrators).
    A policy file can use a keystore to be used in a signed by policy. For example "applets
    that are signed by SUN can access some files on my machine). It can allso be used
    to identify yourselve, when making an SSL connection the keystore can be used as
    the source of your public key.

Maybe you are looking for

  • Audio and Video out of sync in shared iMovie file

    Hey Guys - Quick question, I've created a new trailer in iMovie, all works fine but the audio and video is out of sync in the shared file. How to fix it? Thank you MondCharlie

  • Restore from Tape Backup

    Hi All, Oracle Ver. 10.2.0.4 on Sun-Solaris 9. Need to do a restore and recover on the DR site using the tape backups from production site. The path and file names are same in both sites. In the DR site only the Oracle server software is installed. T

  • Need suggestion to choose the Weblogic Edition

    We are developing the Rich web application using ADF technology which has more number of pages (approx. 700 – 800) also expecting more no. of users (15K). 1.We want to know which weblogic edition (Enterprise or Suite) is suitable for production. 2.Is

  • External authentication question

    Hello, I am running an apex app in a secured environment. The authentication is handled by the environment, and a username passed to apex pages in a server variable, which I am able to use to set apex_application.g_user. Now, the user is only able to

  • Error when installing SAP BI

    Hi, iam going to install BI .iam getting this  following error at the time of installing sofrware units. ERROR 2008-12-04 10:50:14.86 FCO-00011  The step enableUsageTypes with step key |NW_Onehost|ind|ind|ind|ind|0|0|SAP_Software_Features_Enablement|