How to import a package I found online in Java? - java

I am trying to use this class, but i'm having trouble importing it into my code. Anyone know it's not allowing me to import it? It is giving me a "Cannot resolve symbol 'edu'"

You'll find the details here
You need to download the .jarfrom https://search.maven.org/search?q=a:edu-mines-jtk, and add to your classpath,
on a IDE like IntelliJ : Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project
command line https://javarevisited.blogspot.com/2012/10/5-ways-to-add-multiple-jar-to-classpath-java.html
Or use maven, and just add the dependency : What does Maven do, in theory and in practice? When is it worth to use it?

Related

Java library cant resolve package

I added a library with several packages one of which is "no.stelar7.api.r4j.impl.lor". When I go to import this package to use it in my code I am given an error saying it can't be resolved, I have tried deleting the library and re-importing it with no luck and need any help. There is another package in the library called "no.stelar7.api.r4j.impl", is it possible this is causing me errors?
Check if the library available for your current java version

Package Structure In Maven

I have created a maven project on my Mac using Eclipse. My package structure comes in a folder and its hard for me to create a java class. Packages also do not show up.
How can I fix it? tried googling no solution? please help.

Cannot resolve symbols yet library is imported

I'm using libGDX and I've cloned a project down from a repo I pushed too earlier. I've set the project up and imported it to Intellij IDEA but it's giving me import errors. I can actually navigate to the classes that are giving me an error but the IDE doesn't seem to recognise them.
How can I fix this?
When you hover over the unused import Intellij IDEA pops up a little red bulb which allows you to add the library to the classpath. Finding that fixed it.

Steps to resolve the imports in eclipse?

Firstly, I have seen several question related to this issue but it seems like those questions might be some steps ahead of my understanding.
I am fairly new to java and consider myself as a self learning beginner. Mostly I face this problem where I do an import. I need it because that import is linked with the use of some really nice and powerful function(s), but always fail if import does not work and end up not using that.
The message is, e.g. "The import com.google can not be resolved".
I have been using eclipse in Ubuntu.
After trying some of the given solutions without being able to view them in the proper context, I already have messed up my eclipse environment and the trouble is still there.
Can anybody kindly show me the complete steps of doing these imports successfully in eclipse for java?
For using 3rd party jars you need to add the jars in the build path.
Follow the following step
right click project
click build path
click libraries tab
then add external jar
Now give the path of the jar location

EdgeType.DIRECTED not working

I recently figured out how to add the Jung libraries to eclipse, but now I ran into a new problem. I'm using the Jung tutorial and I can't seem to run the first tutorial, because the Eclipse IDE is saying that the .DIRECTED ,in the code, cannot be resolved or is not a field. How do I fix this?
edit: Yes, using that package worked! However, I'm surprised that the Eclipse IDE did not offer to import the package for me. Is this unusual?
Make sure to include all the required JUNG2 libraries into your Eclipse project. When you do that, Eclipse will give a few suggestions after you right-click on those yellow-underlined words. Choose the one(s) related to JUNG2 to remove the warning(s).
EgeType.DIRECTED must be imported from edu.uci.ics.jung.graph.util.EdgeType package which is under jung-graph-impl-2.0.1.jar

Categories