-1

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

jones
  • 1,423
  • 3
  • 35
  • 76

1 Answers1

1

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.

Michael Brohl
  • 782
  • 5
  • 21
  • Now when i import like that one of the error still remained that indicate `can not find package org.apache.commons.fileupload` so please guide me how to solve that. Thanks for help. – jones Mar 02 '15 at 07:53
  • Please answer the questions above (IDE) and show us the full code and where it is stored in your project structure. It's like looking into a crystal ball without these informations. – Michael Brohl Mar 02 '15 at 07:59
  • How was your project imported in Eclipse? commons-fileupload is in the OFBiz package so it should be found. I update my answer to some more hints to correctly setup your own OFBiz module. – Michael Brohl Mar 02 '15 at 08:28
  • Pardon me for asking again. Now my upload script is working properly, my project is in a path like:`/home/itadmin/apache-ofbiz` and file is uploaded in this path, but i have a lot of project in this path, i want to have an upload folder inside each project and upload the files of each project on that folder for example PMS project is in `apache-ofbiz/hot-deploy/pms` but when i define the target path inside Java code exception occur that indicate no such directory is existed, so how can i solve that ? I'm busy with this for along time thanks for help. – jones Mar 05 '15 at 06:38
  • 1
    @jones it would be nice to reward sufficient answers with an upvote or accept, this would motivate others to answer your questions. – Michael Brohl Mar 06 '15 at 14:19
  • 1
    regarding your question: just check if the directory exists and create it if not. – Michael Brohl Mar 06 '15 at 14:20