I have copied my project from one system to another,now I am trying to run it,I am having a message in build path that 95 build path entries are missing. I am having main problem with importing some packages like:
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRField
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.Statement;
import org.krysalis.barcode4j.BarcodeDimension;
import org.krysalis.barcode4j.HumanReadablePlacement;
import org.krysalis.barcode4j.impl.AbstractBarcodeBean;
import org.krysalis.barcode4j.impl.code128.Code128Bean;
import org.krysalis.barcode4j.impl.upcean.EAN13Bean;
import org.krysalis.barcode4j.output.java2d.Java2DCanvasProvider;
import org.jdesktop.swingx.JXTaskPane;
import org.jdesktop.swingx.JXTaskPaneContainer;
import orgimp.pushingpixels.substance.api.SubstanceLookAndFeel;
import org.pushingpixels.substance.api.SubstanceSkin;
if you are using eclipse ,then right click on project
Properties->java build path
now check source all class file src is added or not,
check libraries that all necessary jar is added or not
if yor are running through comand prompt then you need to set path in command line
right click on project
go to properties-->java build path--->Libraries
add all library that needs in your project
and also check your java compiler
go to properties-->java compiler
choose necessary java compiler
------------------------------- OR ---------------------------------------------
it may be possible that required jar files are not present in your lib folder
Try deleting those entries from build path (make sure you leave the jars which eclipse already can find).
Related
I am trying to build a very basic voice recognition application via a tutorial. I need to add sphinx4-core.jar and sphinx4-data.jar. I added them into my library and am attempting to import them into my code and I get a "package edu.cmu.sphinx.api does not exist" error. Here are my import statements:
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.LiveSpeechRecognizer;
import edu.cmu.sphinx.api.SpeechResult;
To add the jar files I went to tools -> libraries -> add JAR/Folder
Please bear with my limited experience of working with Java.
I imported the project https://github.com/karantongay/Split-Large-Excel-File-into-smaller-excel-files-using-Apache-POI into eclipse.
On opening the file excelsplitter.java, I see The import xx cannot be resolved errors against all of the following -
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.DateUtil;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.streaming.SXSSFCell;
import org.apache.poi.xssf.streaming.SXSSFRow;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
I understand that the dependency jar could not be found. What is the easiest way to get this included and make me run this.
I know how to import an existing Maven project in eclipse but that's where my knowledge is limited upto.
As per the information provided above, one of the ways is to convert the existing project into maven projects which can be done using right click on Project -> convert into Maven project and then you will be having Pom.xml available in your project where you can add on dependencies.
For above issue, apart from maven stuff ,if you are using correct jar may be it’s on in the build path of the project.
In your eclipse just right click on Java Project and click Configure and you should see “ Convert to Maven Project ” option.
You should see dialogue like this below. Just add “ Name ” and you should be all set.
Don't forget to add your all custom dependencies in pom.xml file.
I'm new to java , i tried to use word net for senitment analysis .
when i used class of wordnet , i got the following failure in importing
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.lucene.analysis.en.EnglishMinimalStemmer;
import org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileListener;
import org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileTracker;
import org.apache.stanbol.enhancer.engines.sentiment.api.LexicalCategoryClassifier;
import org.apache.stanbol.enhancer.engines.sentiment.api.SentimentClassifier;
import org.apache.stanbol.enhancer.engines.sentiment.util.WordSentimentDictionary;
import org.apache.stanbol.enhancer.nlp.pos.LexicalCategory;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
all the above imports cannot be resolved like org.apache.felix , org.apache.lucene ,org.apache.stanbol,org.osgi
This is because your compiler is not able to find the necessary packages and or libraries that are needed to resolve these imports. These packages must be included in your class path. For example all of the errors regarding
org.apache.felix.scr.annotations.x
can be resolved after downloading the latest .jar from https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.scr.annotations/1.11.0
Follow these steps to include jar files in your class path.
-
Drag the required jar file from your download directory to the src
directory of your project in eclipse
Right click on the jar file, Select Build Path and then select Add To Build Path option.
A dialogue box will appear asking you to link all files in the jar file, just stick with the defaults and hit OK.
You are done now, all your errors regarding imports will be resolved.
These packages need to be within the compiler's class path.
Another way to say it : the compiler needs to be able to know where to find these files. This imposes several constraints:
these files need to actually exist in your hard drive (whether added manually, or automatically by a dependency manager)
they should be organized in folders that match the parts of the package name
the folder where they are must be within the class path, which can be specified with the 'classpath' compiler option, or in your IDE's options
Here's the thing: I've downloaded the javax.mail API, added it under Libraries->Add Jar/Folder. I've compiled the code, but it keeps yielding an error on the 'import javax.mail;' sentence, saying that the package does not exist. What is going wrong?
You've mentioned this line:
import javax.mail;
This won't work, because mail is a package and not a class. Either use:
import javax.mail.*;
to import the whole package or import specific classes using:
import javax.mail.Header;
import javax.mail.Message;
import javax.mail.Session;
(the classes are randomly selected and should only show how to import a specific class)
you commented
I've extracted the javax.mail JAR file to the netbeans8.0.2 folder
you dont need to do that,
it should be enough to put the jar in your project's lib folder and maybe reference it in the build path.
cheers
I am new in Java, I want to run a Java program, it needs three jars: swt-3.6M3-win32-win32-x86.jar,DJNativeSwing-SWT.jar,DJNativeSwing.jar. I have them, but I do not know where I should put them. Can someone help me?
the following is the import codes:
import chrriis.dj.nativeswing.swtimpl.NativeComponent;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserAdapter;
import chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent;
Add them to your class path. In Eclipse: Right click the project>Properties>Java Build Path then add them as external jars.