Results 1 to 4 of 4
  1. #1
    Join Date
    May 2010
    Posts
    22
    Rep Power
    0

    Default Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventLi

    Java Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    package tcplistener;
    
    /**
     *
     * @author baktha
     */
    
    import com.artofsolving.jodconverter.DocumentConverter;
    import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
    import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
    import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    /**
     *
     * @author baktha
     */
    public class Pdfconvertor {
      public static void main(String args[])
        {
            try
            {
             Runtime r = Runtime.getRuntime();
             Process p = Runtime.getRuntime().exec("soffice -headless -accept=socket,host=127.0.0.1,port=8100;urp; -nofirststartwizard");
             BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
             String line = null;
             while ((line = in.readLine()) != null) {
                     System.out.println(line);
              }
    
    
            OpenOfficeConnection connection = new SocketOpenOfficeConnection(8100);
    
            connection.connect();
             File inputFile = new File("/home/baktha/Desktop/Rajat.xls");
            File outputFile = new File("/home/baktha/Desktop/Rajat.pdf");
    
    // convert
            DocumentConverter converter = new OpenOfficeDocumentConverter(connection);
            converter.convert(inputFile, outputFile);
    
    // close the connection
    //connection.disconnect();
    
            converter.convert(inputFile, outputFile);
            connection.disconnect();
    
            }
            catch (IOException e1)
            {
                e1.printStackTrace();
            }
    
        }
    }
    error track

    Java Code:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/star/lang/XEventListener
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
            at tcplistener.Pdfconvertor.main(Pdfconvertor.java:45)
    Caused by: java.lang.ClassNotFoundException: com.sun.star.lang.XEventListener
            at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
            ... 25 more
    Java Result: 1
    i am using linux please help me how to solve this error

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,585
    Rep Power
    23

    Default

    Do you have the jar file that contains the missing class?
    If so you need to put it on the classpath for the jvm to use.

  3. #3
    Join Date
    May 2010
    Posts
    22
    Rep Power
    0

    Default

    please reply which jar file missing

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,585
    Rep Power
    23

    Default

    The one containing the class: com/sun/star/lang/XEventListener
    The class must have been available to the compiler(javac) when the program using that class was compiled. Find that jar file and put it on the classpath for the java command.

    Where do the packages: com.artofsolving.jodconverter come from?

Similar Threads

  1. Replies: 12
    Last Post: 06-06-2012, 09:04 AM
  2. Replies: 1
    Last Post: 04-02-2009, 09:50 PM
  3. Replies: 6
    Last Post: 08-18-2008, 06:44 AM
  4. Replies: 1
    Last Post: 08-06-2007, 06:07 AM
  5. Replies: 2
    Last Post: 08-01-2007, 05:26 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
  •