Import org.junit cannot be resolved - eclipse

I have a class file beginning with the following in Eclipse:
package org.jsoup.parser;
import org.junit.Assert.*;
import org.junit.Test;
import org.jsoup.nodes.Document;
import org.jsoup.parser.HtmlTreeBuilder;
However, Eclipse indicates an error saying that org.junit cannot be resolved. I have already modified the project properties to include jUnit 3 in the classpath, so wouldn't know what to do further.
Ideas?
EDIT: I have included jUnit 4 as suggested but to no avail...

If you want to use org.junit.Assert you should include JUnit 4. JUnit 3 uses junit.framework.* packages.

Related

Type mismatch junit5 #ExtendWith

so this is probably a really dumb question but I just started to migrate a project from junit 4 to 5 and saw that #RunWith() does not longer exists. It is replaced by #ExtendWith. So I tried to do it like this:
import org.jboss.arquillian.junit.Arquillian;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.extension.ExtendWith;
import de.msggillardon.services.journal.JournalService;
import de.msggillardon.system.UserContext;
import de.msggillardon.util.ITDeployment;
#ExtendWith(Arquillian.class)
.....
And I get the following exception: "Type mismatch: cannot convert from Class to Class <? extends Extension>
I am a really bloody beginner and have no Idea how I can fix the problem.. So maybe someone could help me or tell me where I can find the necessary Information.
Thank you all.
Unfortunately, you can't use JUnit 4's Runner as your JUnit Jupiter (part of JUnit 5) extensions. That's a completely new API and not compatible.
Although the JUnit Jupiter programming model and extension model will
not support JUnit 4 features such as Rules and Runners natively, it is
not expected that source code maintainers will need to update all of
their existing tests, test extensions, and custom build test
infrastructure to migrate to JUnit Jupiter. From the official JUnit documentation
So for each #RunWith, you need to use/include the JUnit Jupiter extension. In your particular case of Arquilian, I'm not quite sure if there is already an official extension for this.
The following links might help:
https://developer.jboss.org/thread/274569
https://github.com/arquillian/arquillian-core/issues/137
Arquillian now support junit 5.
Replace
#RunWith(Arquallian.class)
with
#ExtendWith(ArquillianExtension.class)
Also add the new dependency
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
<version>1.7.0.Alpha10</version>
</dependency>

Cannot import external JAVA library using Jython in Eclipse

I'm new to Jython and to Eclipse. I'm trying to use the JGraphX JAVA library. I've created a new PyDev project and package. I've right-clicked on the project properties in Eclipse, selected "PyDev - PYTHONPATH" and added jgraphx.jar. In the init.py file, I've tried:
import jgraphx as jgx
from jgraphx import *
Neither approach works. The code is underlined as an error in Eclipse. When I run, I get "ImportError: No module named jgraphx". What am I doing wrong?
Thank you,
-david
I'm not familiar with the JGraphX library.
To import a java class
you need to use from my.project.package import someclass

Building Hbase on eclipse using Maven (The import org.apache.hadoop.hbase.tmpl cannot be resolved)

I use the maven to import Hbase source on eclipse.
But there has a error that is "The import org.apache.hadoop.hbase.tmpl cannot be resolved)".
I had find the tmpl package , but its "jamon".
How to find the tmpl package, and its "java"?
Can find the tmpl package on Hbase.bin.tar, and import the extend tmpl.jar
It will work.

cannot find jars for the imported Giraph packages

I was trying to run the SSSP giraph program from Eclipse. But I couldnt get the following packages imported
import org.apache.giraph.graph.BasicVertex;
import org.apache.giraph.graph.BspUtils;
import org.apache.giraph.graph.GiraphJob;
import org.apache.giraph.graph.EdgeListVertex;
import org.apache.giraph.graph.VertexReader;
import org.apache.giraph.graph.VertexWriter;
import org.apache.giraph.lib.TextVertexInputFormat;
import org.apache.giraph.lib.TextVertexInputFormat.TextVertexReader;
import org.apache.giraph.lib.TextVertexOutputFormat;
import org.apache.giraph.lib.TextVertexOutputFormat.TextVertexWriter;
I have followed the instruction in the giraph site to build Giraph and Hadoop.
Which jar should be imported to get the above packages?
Are you running the code for the correct version of Giraph? I think the imports you mention are for versions before 1.0.0, if you include a jar for a newer version it won't find them.

Import cannot be resolved in Eclipse from dependency in Play 2.0

I successfully added a dependency in Play 2.0 and was able to compile the project. When I try to run a simple test to render a PDF I get this error:
The import com.itextpdf cannot be resolved
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
How do I clear this error with Play managing this dependency?
I solved this problem by running "play eclipse" on my project in command line and then Project-->Clean in Eclipse. Similarly for Intellij "play idea" and then File > Invalidate Caches > Invalidate and restart.
If the dependency is properly added, the jar should now be on the build path. Could you check if it actually is on your buildpath? Note that the /lib directory of your project is automatically included. You could try making a symlink in /lib to the jar