I use eclipese 2018-09 (4.9.0) I'm try to use jfreechart, I added the jars in the module path(jcommon,jfreechart), I do organize import
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;
import org.jfree.util.Rotation;
i get "The import org.jfree.chart cannot be resolved" for all imports and the consequential errors, what's the problem?Thanks
Related
package com.test.redis.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import javax.sql.DataSource;
import java.sql.SQLException;
IDEA SpringTooSuit4, maven pom.xml config jpa.
javax.sql.DataSource,java.sql.SQLException can not be resolved.
no idea ............
expect import success
try to import this maven library
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.0.32</version>
</dependency>
it should be jre compatibility issue, jre1.8 is ok
So i was going through many stackoverflow answers and i tried applying them on my code, but i still couldn't find fix for this error. Also this error happens only when i try to Run the app only. i can build the project without any issues.
So this is the error i'm getting.
error: cannot access zzbgl class file for com.google.android.gms.internal.zzbgl not found
Also after that i'm getting this as a warning
D:\FinalProject\app\src\main\java\com\example\www\mytaxiapp\Welcome.java:
uses or overrides a deprecated API.
Recompile with -Xlint:deprecation for details.
So far i tried changing the versions and commenting, also adding and removing dependencies, but still i was unable to find a solution for this. hope someone can help me here.
This is my gradle APP level file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.www.mytaxiapp"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.github.glomadrian:MaterialAnimatedSwitch:1.1#aar'
implementation 'com.firebase:geofire-android:2.1.2'
implementation 'com.github.d-max:spots-dialog:0.7#aar'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:design:27.1.0'
//Add Library
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support:cardview-v7:26.+'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
My Welcome.class file imports
package com.example.www.mytaxiapp;
import android.Manifest;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.os.Handler;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.widget.Toast;
import com.firebase.geofire.GeoFire;
import com.firebase.geofire.GeoLocation;
import com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptor;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Welcome extends FragmentActivity implements OnMapReadyCallback,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener
{
Updating location service did the work for me ;)
implementation 'com.google.android.gms:play-services-location:15.0.1'
Google GMS is a very large dependency. You could try to enable multidex (by adding following line to your defaultConfig:
defaultConfig {
...
multiDexEnabled true
...
}
If you are targeting lower Android-versions, it can be, that you need to include support-Multidex as a dependency:
implementation 'com.android.support:multidex:1.0.3'
In this case, you should add a Application-class whilst you overwrite attachBaseContext like this:
#Override
protected void attachBaseContext(Context base) {
MultiDex.install(this);
super.attachBaseContext(base);
}
Please don't forget the clear project and gradle-sync.
Hope that helps.
I'm trying to run a face recognition example using javacv, but there is a mismatch in the methods arguments types.
I'm using the following maven dependencies:
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<version>3.0.0-1.1</version>
</dependency>
<dependency>
I'm referring to this example: http://pcbje.github.io/misc/2012/12/01/doing-face-recognition-with-javacv.html
Imports:
import static org.bytedeco.javacpp.opencv_face.createFisherFaceRecognizer;
import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2GRAY;
import static org.bytedeco.javacpp.opencv_imgproc.cvCvtColor;
import static org.bytedeco.javacpp.opencv_imgcodecs.cvLoadImage;
import static org.bytedeco.javacpp.opencv_core.IPL_DEPTH_8U;
import java.io.File;
import java.io.FilenameFilter;
import org.bytedeco.javacpp.opencv_core.IplImage;
import org.bytedeco.javacpp.opencv_core.Mat;
import org.bytedeco.javacpp.opencv_core.MatVector;
import org.bytedeco.javacpp.opencv_face.FaceRecognizer;
The only difference is that they are using com.googlecode.javacv, but as far as I understand this is old. However I downloaded those jars from http://www.java2s.com/Code/Jar/j/Downloadjavacvjar.htm, but I'm still not able to compile successfully.
Can you please advice. Thank you.
[SOLVED] - Please refer to this example
I am trying to test java methods within a multiple package project that has numerous imports. It works fine until it gets to the javax imports. Tnen it complains that it cannot find the class definition for this import. Do I need to explicitly import a jar even though it was part of the maven dependencies when I complied the jars that this project is using?
This is the declarations section of my code package
package com.fietrade.swtf.swreconcilation.beans;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import javax.faces.application.FacesMessage;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.xml.sax.SAXException;
import com.fietrade.swtf.persistance.factories.DBMgrFactory;
import com.fietrade.swtf.persistance.factories.ReconciliationDBMgr;
import com.fietrade.swtf.persistance.swapswire.Reconciliation;
public class ReconciliationEditor {
And this is the error:
__EXCEPTION__:java.lang.NoClassDefFoundError: javax/faces/validator/ValidatorException
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_40]
at java.lang.Class.forName(Class.java:190) [rt.jar:1.7.0_40]
at fitnesse.slim.SlimExecutionContext.getClass(SlimExecutionContext.java:139) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimExecutionContext.searchPathsForClass(SlimExecutionContext.java:129) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimExecutionContext.createInstanceOfConstructor(SlimExecutionContext.java:100) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimExecutionContext.create(SlimExecutionContext.java:42) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.StatementExecutor.create(StatementExecutor.java:75) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.instructions.MakeInstruction.executeInternal(MakeInstruction.java:26) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.instructions.Instruction.execute(Instruction.java:30) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:50) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:44) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.ListExecutor.execute(ListExecutor.java:84) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:106) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.processTheInstructions(SlimServer.java:93) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:68) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:54) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.serve(SlimServer.java:40) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.handle(SlimService.java:164) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.acceptOne(SlimService.java:172) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.accept(SlimService.java:134) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:65) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.main(SlimService.java:51) [fitnesse-standalone-20140903.jar]
Caused by: java.lang.ClassNotFoundException: javax.faces.validator.ValidatorException
Can someone explain what this error is and how to resolve it?
Thanks
Basically it says It is not able to find a dependancy for your project to work ..
include jsf-api
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
Add this to your project and error will be resolved.
I am trying to run a selenium test case file written in java using Apache Ant. To setup this configuration, i followed this tutorial.
below is my ant config in build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="Hello World Project" default="info">
<target name="info">
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<pathelement path="lib\junit-4.10.jar" />
</classpath>
<test name="com.lo.test.selenium.AssignCampaignTestCase" haltonfailure="no" outfile="result">
<formatter type="plain"/>
<formatter type="xml"/>
</test>
</junit>
</target>
</project>
But it is showing error like :
Testsuite: com.lo.test.selenium.AssignCampaignTestCase
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
Caused an ERROR
com.lo.test.selenium.AssignCampaignTestCase
java.lang.ClassNotFoundException: com.lo.test.selenium.AssignCampaignTestCase
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
Test case code in AssignCampaignTestCase.java
package com.lo.test.selenium;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Properties;
import java.util.ResourceBundle;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Store;
import javax.ws.rs.core.MediaType;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
import com.sun.jersey.multipart.FormDataMultiPart;
import com.sun.jersey.multipart.impl.MultiPartWriter;
/**
* #author Ashutosh
*
*/
public class AssignCampaignTestCase {
private static ResourceBundle rb = ResourceBundle.getBundle("global-messages");
static WebDriver driver = new FirefoxDriver(); //Make it static in order to make one instance of this class(helps to avoid opening of 2 browsers at once)
#Test
public void campaignEmailTestCase() throws InterruptedException {
AssignCampaignTestCase emTesObj=new AssignCampaignTestCase();
// CommonMethods commonMethods=new CommonMethods();
String fName="test LO";
Integer LeadId=570903;
String campaignName="2GetMoreLeads";
String SubjName="Welcome to your 5-day challenge and tips"; //NOTE: No problem,Type without double quotes. It will work for you
doLogin(driver);
emTesObj.goToLeadsListPage();
emTesObj.searchByFirstName(fName);//without this also,it will work but Gives you the correct navigation on UI
emTesObj.waitBeforePageLoads(LeadId.toString()); //pass the Id attribute which you aspect to see after the page is loaded
emTesObj.assignCampaign(LeadId, campaignName);
emTesObj.readRecentEmail(SubjName);
}
//shows you the leads List Page
public void goToLeadsListPage(){
driver.get("http://www.xxxxx.com/orderManagement/xxxx.action");
}
.................
.................
.................
Here is my project structure::::
Please help me to run my project using Ant.
Try adding selenium jar file in you classpath. Currently you only added junit.