Page 1 of 3 123 LastLast
Results 1 to 20 of 58
  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default the same old story: java.lang.ClassNotFoundException

    Can't get my applet to work on a web page, it does work on the NetBean applet viewer!
    Should the applet equal to an application start from a Main.class (I tried that one and did\not work either). So next see the info of Tag etc.

    <applet code=slideshowapplet.class
    archive="slideshow.jar"
    width=600 height=500>
    </applet>



    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.0
    Created-By: 1.6.0_43-b01-447-10M4203 (Apple Inc.)
    Main-Class: slideshow.Main
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by build

    the Jar files:
    slideshowapplet$ButtonDialog.clas
    slideshowapplet$DisplayScreen.class
    slideshowapplet$TimeSetter.class
    slideshowapplet.class



    java.lang.ClassNotFoundException: slideshowapplet.class
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Ap plet2ClassLoader.java:262)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(P lugin2ClassLoader.java:263)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:193)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:174)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plu gin2ClassLoader.java:713)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plu gin2Manager.java:3052)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Plugin2Manager.java:1497)
    at java.lang.Thread.run(Thread.java:680)

  2. #2
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    now I got this one:

    java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
    at java.security.AccessControlContext.checkPermission (AccessControlContext.java:374)
    at java.security.AccessController.checkPermission(Acc essController.java:549)
    at java.lang.SecurityManager.checkPermission(Security Manager.java:532)
    at java.lang.SecurityManager.checkPropertyAccess(Secu rityManager.java:1285)
    at java.lang.System.getProperty(System.java:667)
    at slideshow.Main.checkImageFolders(Main.java:262)
    at slideshow.Main.init(Main.java:88)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Plugin2Manager.java:1639)
    at java.lang.Thread.run(Thread.java:680)

  3. #3
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    so I corrected the tag still not working:
    (there is one single file that runs the applet which is called now 'Main"
    because the MANIFEST says: Main-Class: slideshow.Main


    Java Code:
    <applet code=Main.class
            archive="slideshow.jar"
            width="600" height="500">
    </applet>

  4. #4
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    This is crazy difficult to run:

    1) So the slideshow.jar file is at the same directory as the HTML applet tag
    2) The jar has a Main.class with the applet init etc.
    3) The MANIFEST.MF says:

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.8.0
    Created-By: 1.6.0_43-b01-447-10M4203 (Apple Inc.)
    Main-Class: slideshow.Main
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by build

    4) The tag says:
    <applet code=Main.class
    archive="slideshow.jar"
    width="600" height="500">
    </applet>

  5. #5
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    5) The Jar files:
    Main$ButtonDialog.clas
    Main$DisplayScreen.class
    Main$TimeSetter.class
    Main.class

  6. #6
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    Anyway how to edit this MANIFEST.MF file....

  7. #7
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    I did edit the MANIFEST.
    1) unzip the jar
    2) open the MANIFEST with Netbean editor
    3) changed Main-Class: slideshow.Main into
    Main-Class: slideshow.SlideShowApplet
    4) saved it and zipped the file and named it jar instead of zip

    But now mac-os put in some crap I cannot take out.....

  8. #8
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    Now I got this one:

    java.lang.NoClassDefFoundError: SlideShowApplet (wrong name: slideshow/SlideShowApplet)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader. java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :615)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
    at sun.plugin2.applet.Applet2ClassLoader.findClass(Ap plet2ClassLoader.java:257)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(P lugin2ClassLoader.java:263)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:193)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Pl ugin2ClassLoader.java:174)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Plu gin2ClassLoader.java:703)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plu gin2Manager.java:3052)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Plugin2Manager.java:1497)
    at java.lang.Thread.run(Thread.java:680)

  9. #9
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    the MANIFEST says:
    Main-Class: slideshow.SlideShowApplet
    so what wrong name?

  10. #10
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    now this:

    java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
    at java.security.AccessControlContext.checkPermission (AccessControlContext.java:374)
    at java.security.AccessController.checkPermission(Acc essController.java:549)
    at java.lang.SecurityManager.checkPermission(Security Manager.java:532)
    at java.lang.SecurityManager.checkPropertyAccess(Secu rityManager.java:1285)
    at java.lang.System.getProperty(System.java:667)
    at slideshow.SlideShowApplet.checkImageFolders(SlideS howApplet.java:262)
    at slideshow.SlideShowApplet.init(SlideShowApplet.jav a:88)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionR unnable.run(Plugin2Manager.java:1639)
    at java.lang.Thread.run(Thread.java:680)

  11. #11
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    this stuff should be easier.

  12. #12
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)

    ok I do read a list of image files at my hard disk: not of the client's one. So what is the problem?

    Java Code:
     private void checkImageFolders(String currentf) {
            // two image folders has to been checked:
            // 1) the first one called images
            // 2) the second inside iamges called slidshow
            // 3) inside the last one are the picture files for display
            String workingDir = System.getProperty("user.dir");
            String imagefolder = workingDir + File.separator + "images" +
                    File.separator + "slideshow";
            currentimagefolder = imagefolder + File.separator + currentf;
            boolean folderexsistflag = false;
    
            String path = "";
    
            String files = "";
            File folder1 = new File(imagefolder);
            File folder2 = new File(currentimagefolder);
    
            if (folder1.exists()) {
                System.out.println(" yes file exsist " + folder1);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no file exsist " + folder1);
                folderexsistflag = false;
            }
            if (folder1.isDirectory())  {
                System.out.println(" yes is folder " + folder1);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no is not folder " + folder1);
                folderexsistflag = false;
            }
    
    
    
            if (folder2.exists()) {
                System.out.println(" yes file exsist " + folder2);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no file exsist " + folder2);
                folderexsistflag = false;
            }
    
    
            if (folder2.isDirectory())  {
                System.out.println(" yes is folder " + folder2);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no is not folder " + folder2);
                folderexsistflag = false;
            }
    
            if (folderexsistflag) {
                doListofImagefiles(folder2);
            }
            else  {
                System.out.println("no folder/ folders present, cannot precede");
            }
    
        }

  13. #13
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    here I check if files are image files
    and get the list of those files
    I can not do that in a applet?

    Java Code:
    private void doListofImagefiles( File currentf)  {
    
            File[] listOfFiles = currentf.listFiles();
            imagefiles = new ArrayList();
            System.out.println(); System.out.println();
    
            for (int i = 0; i < listOfFiles.length; i++)  {
                String file = listOfFiles[i].getName();
                System.out.print(i + "  > " + file );
                if (listOfFiles[i].isFile()) {
                      if (checkImageType(listOfFiles[i]))  {
                          //  System.out.println(file);
                             imagefiles.add(file);
                           //  System.out.println();
                             maximages = imagefiles.size();
                      }
                }
            }  System.out.println(" the array list length is: " + imagefiles.size());
    
        }
    
        private boolean checkImageType (File f)  {
            boolean flag = false;
    
                    String fl = ft.getContentType(f);
    
                    String type = fl.split("/")[0];
                    if(type.equals("image"))  {
                            System.out.println("  Is an image:  <" + fl.split("/")[1] + ">   ");
                            return true;
                    }
                    else  {
                            System.out.println("  Is NOT an image");
                            return false;
                    }
        }

  14. #14
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: the same old story: java.lang.ClassNotFoundException

    It is easier if you understand packages, and that seemed to be the root of your problem.
    You also flail so much that no one here can possibly keep up with exactly what the problem is and what your tag, jar and code looks like.

    Anyway, I'm guessing you have it executing and are now trying to resolve the access exception.
    You appear to be trying to access files on the client machine. If your jar is not signed then you cannot do that. Indeed it won't be long before you can't do that unless it is signed through a proper signing authority.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  15. #15
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    Yes, you're right Tolls, it's like talking to myself which I should
    not be doing because at the end it's not very clear all....
    But ok, here is the problem in short terms:
    -I do not try to excess the disk of a client!
    -the applet displays some images which I have at the
    work dir in a file images, that's all

    But maybe java does see this as entering somebody's else's
    hardisk?

    Anyway I should tell java, right? But how?

    thanks Toll

  16. #16
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: the same old story: java.lang.ClassNotFoundException

    If that code above is from the applet, then it is accessing the File system (see the use of File above) on the client.
    No two ways about it.
    An applet cannot access file on the server using File, or any of the file io classes. It's only allowed to access the server via (I think) a URL, and it has to be the server the applet originated from. Unless it is signed.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  17. #17
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    Wow, tolls I don't think so.....
    here is the complete code of the applet:
    (any comments welcome, I am still learning you know)
    Java Code:
    /*
     * 
     */
    
    package slideshow;
    
    /**
     *
     * 
     */
    
    
    import javax.swing.JApplet;
    import java.io.File;
    import java.io.IOException;
    import javax.activation.MimetypesFileTypeMap;
    import javax.imageio.ImageIO;
    import javax.swing.border.Border;
    
    import java.awt.*;
    import java.util.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.Timer;
    
    /**
     *
     * @author dragstrawillem
     */
    public class SlideShowApplet extends JApplet implements Runnable {
        String name;
        Thread runner;
        private MimetypesFileTypeMap ft;
        private JPanel imagePanel, mainPanel;
        private int screenx = 700, screeny = 600, xwindowsize = 1000,
                ywindowsize = 800, imageWidth, imageHeight, slidetime = 5,
                maximages, imagecount;
        private boolean buttons = true;
        private String currentimagefolderpath, foldername;
        private ActionListener blistener;
        private ActionListener timelistener;
        private ArrayList imagefiles;
        private JButton stop, backward, forward;
        private DisplayScreen DS;
        private Color bluecolor, blackcolor, redcolor;
        private Timer time;
    
    
    
        public void init() {
    
            // the five parameters set the functions of the
            // slideshow: foldername that contains the pictures
            // within workdir images/slideshow/foldername to set
            // next the duration in seconds
            // the screen size of the slides in x/y
            // and finally the flag for the buttons if thrue
            // there are buttons to stop and forward/ backward images
    
            // the applet tag parameters
         //   foldername = getParameter("foldername");
         //   slidetime = Integer.parseInt(getParameter("imagetime"));
         //   screenx = Integer.parseInt(getParameter("sizeX"));
         //   screeny = Integer.parseInt(getParameter("sizeY"));
         //   buttons = Boolean.parseBoolean(getParameter("buttons"));
    
    
         //   foldername = imagefoldername;
          //  slidetime = timeinseconds;
         //   screenx = imagescreenX;
         //   screeny = imagescreenY;
         //   buttons = imagebuttons;
    
            setBounds(100, 100, xwindowsize, ywindowsize);
            bluecolor = Color.BLUE;
            blackcolor = Color.BLACK;
            redcolor = Color.RED;
    
            ft = new MimetypesFileTypeMap(); // image type check
    
            foldername = "calella";
            slidetime = 2;
            screenx = 400;
            screeny = 300;
            buttons = true;
    
            checkImageFolders(foldername);
        //    timer();
           // starttimer();
        }
    
    
        public void start() {
    
            if (runner == null); {
                runner = new Thread(this);
                runner.start();
    
                System.out.println("Thread started.");
            }
    
        }
    
        public void stop() {
    
    
    
                if (runner != null) {
                    runner.interrupt();
                    runner = null;
                    stoptimer();
                    System.out.println("Thread successfully stopped.");
                    System.out.println("timer stopped ");
                }
    
        }
    
        public void destroy() {
    
        }
    
        public void run() { // what your applet actually does
            // this method checks the presences of the two image folders
            // 1) images amd slideshow folder
            // 2) the specific folder within the second folder set by the applet tag
    
    
            blistener = new ButtonDialog();
            timelistener = new TimeSetter();
            DS = new DisplayScreen();
            // add panel to frame
            mainPanel = new JPanel(new BorderLayout());
            imagePanel = new JPanel();
            Color redcolor = Color.RED;
            Border etched2 = BorderFactory.createEtchedBorder(redcolor, redcolor);
    
            imagePanel.setBorder(etched2);
            mainPanel.add(DS, BorderLayout.CENTER);
            JPanel bp = new JPanel();
            bp = createButtons();
            if (buttons)
            mainPanel.add(bp, BorderLayout.SOUTH);
    
            this.add(mainPanel);
    
    
            stop.setText("STOP");
            backward.setEnabled(false);
            forward.setEnabled(false);
            timer();
            starttimer();
        }
    
    
    
        public JPanel createButtons() {
            JPanel jp = new JPanel(new FlowLayout(FlowLayout.CENTER));
            JPanel cjp = new JPanel();
            cjp.setLayout(new BorderLayout());
    
            backward = new JButton("BW");
            backward.setPreferredSize(new Dimension(65, 30));
            stop = new JButton("STOP");
            stop.setPreferredSize(new Dimension(65, 30));
            forward = new JButton("FW");
            forward.setPreferredSize(new Dimension(65, 30));
    
            backward.setActionCommand("BW");
            stop.setActionCommand("STOP");
            forward.setActionCommand("FW");
            backward.addActionListener(blistener);
            stop.addActionListener(blistener);
            forward.addActionListener(blistener);
            cjp.add(backward, BorderLayout.LINE_START);
            cjp.add(stop, BorderLayout.CENTER);
            cjp.add(forward, BorderLayout.LINE_END);
            jp.add(cjp);
    
            Border etched = BorderFactory.createEtchedBorder(bluecolor, bluecolor);
    
            cjp.setBorder(etched);
    
            return jp;
        }
    
    
        public class ButtonDialog implements ActionListener {
    
           public void actionPerformed(ActionEvent e) {
    
               String cmd = e.getActionCommand();
    
                if ((cmd.equals("FW"))) {
                    imagecount++;
                    if (imagecount >= maximages) imagecount = 0;
                    DS.getImage(currentimagefolderpath + File.separator +
                                            imagefiles.get(imagecount) );
                    repaint();
                }
    
                if ((cmd.equals("BW"))) {
    
                    if (imagecount <= 1) imagecount = maximages;
                    imagecount--;
                    DS.getImage(currentimagefolderpath + File.separator +
                                            imagefiles.get(imagecount) );
                    repaint();
                }
    
                if (cmd.equals("STOP"))  {
                   if (stop.getText().equals("START")) {
                       starttimer();
                       backward.setEnabled(false);
                       forward.setEnabled(false);
                       stop.setText("STOP");
                   }
                   else {
                       stoptimer();
                       backward.setEnabled(true);
                       forward.setEnabled(true);
                       stop.setText("START");
                   }
    
               }
    
          }
       }
    
       public void timer()  {
            time = new Timer((1000 * slidetime), timelistener);
            time.setRepeats(true);
       }
       public void starttimer() {
             time.start();
       }
       public void stoptimer() {
             time.stop();
       }
    
       class  TimeSetter implements ActionListener {
            public void actionPerformed(ActionEvent event)  {
                  //  System.out.println(" <TIMER> ");
                    imagecount++;
                    if (imagecount >= maximages) imagecount = 0;
                    DS.getImage(currentimagefolderpath + File.separator +
                                            imagefiles.get(imagecount) );
                    repaint();
    
            }
       }
    
    
    
        private void checkImageFolders(String currentf) {
            // two image folders has to been checked:
            // 1) the first one called images
            // 2) the second inside iamges called slidshow
            // 3) inside the last one are the picture files for display
            String workingDir = System.getProperty("user.dir");
            String imagefolder = workingDir + File.separator + "images" +
                    File.separator + "slideshow";
            currentimagefolderpath = imagefolder + File.separator + currentf;
            boolean folderexsistflag = false;
    
            String path = "";
    
            String files = "";
            File folder1 = new File(imagefolder); // first image folder "images"
            File folder2 = new File(currentimagefolderpath); // second "slideshow"
    
            if (folder1.exists()) {
                System.out.println(" yes file exsist " + folder1);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no file exsist " + folder1);
                folderexsistflag = false;
            }
            if (folder1.isDirectory())  {
                System.out.println(" yes is folder " + folder1);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no is not folder " + folder1);
                folderexsistflag = false;
            }
    
    
    
            if (folder2.exists()) {
                System.out.println(" yes file exsist " + folder2);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no file exsist " + folder2);
                folderexsistflag = false;
            }
    
    
            if (folder2.isDirectory())  {
                System.out.println(" yes is folder " + folder2);
                folderexsistflag = true;
            }
            else  {
                System.out.println(" no is not folder " + folder2);
                folderexsistflag = false;
            }
    
            if (folderexsistflag) {
                doListofImagefiles(folder2);
            }
            else  {
                System.out.println("no folder/ folders present, cannot precede");
            }
    
        }
    
        private void doListofImagefiles( File currentfpath)  {
            // storing the present files of the folder
            // into a temporal array for checking
            File[] listOfFiles = currentfpath.listFiles();
            //the array list will contain the correct files
            imagefiles = new ArrayList();
            System.out.println(); System.out.println();
    
            for (int i = 0; i < listOfFiles.length; i++)  {
                String file = listOfFiles[i].getName();
                System.out.print(i + "  > " + file );
                // check for files against folders
                if (listOfFiles[i].isFile()) {
                    //adding the checked correct image files
                      if (checkImageType(listOfFiles[i]))  {
                          //  System.out.println(file);
                             imagefiles.add(file);
                           //  System.out.println();
                             
                      }
                      
                }
            }  
            maximages = imagefiles.size();
            System.out.println(" the array list length is: " + maximages);
        }
    
        private boolean checkImageType (File f)  {
            boolean flag = false;
    
                    String fl = ft.getContentType(f);
    
                    String type = fl.split("/")[0];
                    if(type.equals("image"))  {
                            System.out.println("  Is an image:  <" + fl.split("/")[1] + ">   ");
                            return true;
                    }
                    else  {
                            System.out.println("  Is NOT an image");
                            return false;
                    }
        }
    
    
    
    
    
        // inner class that draws the photos
    
        class DisplayScreen extends JPanel {
            private Image img;
    
    
            public DisplayScreen() {
                getImage(currentimagefolderpath + File.separator +
                                            imagefiles.get(0) );
                repaint();
            }
    
    
    
            public void getImage(String imagefilepath)      {
    
                try {
                        img = ImageIO.read(new File(imagefilepath));
    
                        scaleImage(img.getWidth(null), img.getHeight(null));
                }
                catch (IOException e) {
                }
            }
    
    
            public void scaleImage(int w, int h)  {
                   imageWidth = screenx;
                   imageHeight = screeny;
                   double rat = 1.0;
                //   if (Math.abs(w-imageWidth) >= Math.abs(h-imageHeight)) {
                   if ((w-imageWidth) >= (h-imageHeight)) {
                       rat = (double) imageWidth / (double)  w;
                   }
                   else  {
                       rat = (double) imageHeight / (double) h;
                   }
                   imageWidth = (int) ( w * rat);
                   imageHeight = (int) ( h * rat);
            }
    
    
            public void paint(Graphics g) {
                    Graphics2D g2 = (Graphics2D)g;
                    g2.setPaint(Color.red);
                    Rectangle rect = new Rectangle(100, 100, screenx, screeny);
                    g2.draw(rect);
    
                        //  BufferedImage bi = new
                        //  BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
                        //  g = bi.getGraphics();
                    g2.drawImage(img, 100, 100, imageWidth, imageHeight, null);
            }
        } // end inner class
    
    
    
    
        // TODO overwrite start(), stop() and destroy() methods
    
    }
    Last edited by willemjav; 04-16-2013 at 05:37 PM.

  18. #18
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: the same old story: java.lang.ClassNotFoundException

    And?
    The applet cannot do anything with File BUT access the client system.
    Java Code:
    String workingDir = System.getProperty("user.dir");
    String imagefolder = workingDir + File.separator + "images" + File.separator + "slideshow";
    currentimagefolderpath = imagefolder + File.separator + currentf;
    That's even setting the 'currentimagefolderpath' to somewhere under the user's home directory.

    Applets sit on a browser.
    The browser is on the client.
    It doesn't matter whether that client happens to also be your server.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  19. #19
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    9

    Default Re: the same old story: java.lang.ClassNotFoundException

    So If the client happens to be my server, what I do to make this work?
    Assuming that the file folders are at that dir. too with the pictures I want to show?
    Thank you of making me aware of what is going on, but there should be a difference
    between the server that holds the applet and the "client" that views that applet, right!

  20. #20
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: the same old story: java.lang.ClassNotFoundException

    No.
    The applet runs on the client.
    Always.
    If there are things on the server you want then you can either package them in a jar and add that to the applet tag, or you access them through the server.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Page 1 of 3 123 LastLast

Similar Threads

  1. java.lang.ClassNotFoundException
    By oim415 in forum New To Java
    Replies: 3
    Last Post: 11-19-2012, 12:01 PM
  2. java.lang.ClassNotFoundException - Issue
    By C.phantasy in forum New To Java
    Replies: 3
    Last Post: 11-05-2012, 05:58 AM
  3. java.lang.ClassNotFoundException
    By djgovins in forum Java Servlet
    Replies: 4
    Last Post: 07-25-2011, 12:54 PM
  4. Replies: 8
    Last Post: 11-04-2010, 02:46 PM
  5. java.lang.ClassNotFoundException
    By ravian in forum New To Java
    Replies: 1
    Last Post: 01-07-2008, 11:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •