Search code examples
javaofbizapache-commons-fileupload

Java OFBiz can not find symbol import java.io.FileOutPutStream and package org.apache.commons.fileupload does not exits?


I want to user from file upload in Java OFBiz but when i do the following error occur:

import java.io.FileOutPutStream;
import org.apache.commons.fileUpload; 

and other io, and apache packages bellow error occur:

Can not find symbol import java.io.FileOutPutStream Symbol: class FileOutPutStream

and another error

package org.apache.commons.fileupload does not exist.

I use eclipse , and the following is structure of path that code stored: hot-deploy->my_project->src->file.java for Java files hot-deploy->my_project->widget->myScreens->fileUploadScreens.xml 'hot-deploy->my_project->widget->myForms->fileUploadForms.xml' But their is no lib folder inside WEB-INF


Solution

  • Your import statements are wrong, they should be

    import java.io.FileOutputStream;
    import org.apache.commons.fileupload.*;
    

    I recommend to set up a new OFBiz module using the ant target

    ./ant create-component
    

    and answer the following questions. This will install a skeleton module in hot-deply and will be able to access everything OFBiz delivers OOTB.

    You should also check if the OFBiz .project file for Eclipse is read correctly. You should see a lot of source (src) folders and libraries in the project properties/build path of your project. if not, your .project file is not recognized.