Error Building Microlog

Help
NVR
2009-06-17
2013-04-26
  • NVR

    NVR - 2009-06-17

    Hi all,

    I'm trying to use microlog in my project. To do so, I included the source code and deleted some Appenders that I won't use. However, I have an error when building the project in NetBeans in the Class JarFilePropertyReader at the time of getting an InputStream with the file:

    inputStream = PropertyFile.class.getClass().getResourceAsStream(fileName);

    /Users/Narseo/NetBeansProjects/Goose/src/microlog/io/JarFilePropertyReader.java:102: cannot access java.lang.NoClassDefFoundError
    file java/lang/NoClassDefFoundError.class not found
                inputStream = PropertyFile.class.getClass().getResourceAsStream(fileName);
    1 error
    /Users/Narseo/NetBeansProjects/Goose/nbproject/build-impl.xml:398: Compile failed; see the compiler error output for details.
    BUILD FAILED (total time: 0 seconds)

    Everything looks good for me but I have no idea what is going wrong. It seems like if I'm trying to use methods that I must not. The source code is:

        private String readPropertyfile() {
            InputStream inputStream = null;

            if (fileName != null && fileName.length() > 0) {
                inputStream = PropertyFile.class.getClass().getResourceAsStream(fileName);
               
            } else {
                System.out.println("No file name specified.");
            }

            String configString = null;

            if (inputStream != null) {
                System.out.println("Using property file " + fileName);
                // get a string with the contents of the file; configString
                try {
                    int readBytes = inputStream.read(buffer);
                    while (readBytes > 0) {
                        String string = new String(buffer, 0, readBytes, "UTF-8");
                        stringBuffer.append(string);
                        readBytes = inputStream.read(buffer);
                    }

                    if (stringBuffer.length() > 0) {
                        configString = stringBuffer.toString();
                        // configString is used below
                    }
                } catch (IOException e) {
                    System.err.println("Failed to read property file " + e);
                } finally {
                    try {
                        inputStream.close();
                    } catch (IOException e) {
                        System.err
                                .println("Failed to close the property file " + e);
                    }
                }

            } else {
                System.out.println("Warning! Property file not found: " + fileName);
            }
            return configString;
        }

    Many thanks in advance

     
    • Johan Karlsson

      Johan Karlsson - 2009-08-15

      Hi,

      It seems that you have changed the jar after it has been added to NetBeans. As far as I can see this is not a bug in Microlog.

      Regards
      Johan

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks