Find from which library the class comes from in eclipse - eclipse

Lets say I have a import line in my class:
import org.apache.log4j.Logger;
How can I know from which library does it come from? Lets say I have maven folder, that contains tons of libraries.
Why?
I want to use this class/library in my other project, but I don't know which JAR to copy.

Open type (Ctrl-Shift-T) enter org.apache.log4j.Logger, and you'll see which jar it belongs to (in gray).

Related

Android Studio - import can find package but not class

It's hard to describe without an image:
Edit: (I can't post an image till I have more reputation).
The jar exists in External Libraries, and the package contains the class ('org.robolectric.AndroidManifest'). The import statement is grey up till the word 'robolectric', but is red on 'AndroidManifest'. When I click into the package (robolectric), it takes me to the correct package, which apparently contains the class.
This is the only Robolectric library in the application, so it isn't a case of looking at one library while using another.
It's similar to this issue, but the solution didn't work.
I've cleaned, rebuilt, reindexed.
The solution I found simply involved turning all the 'testCompile' in gradle.build into 'compile'. I don't know why this works.

Is the J2SE com.google.zxing.client.j2se.MatrixToImageWriter still the standard way to write barcodes?

I notice that there are a lot of old tutorials from about 2010 that use
com.google.zxing.client.j2se.MatrixToImageWriter
to write 2D barcodes to files.
Also, I notice a lot of old tutorials specify the use of Android.
I am using Eclipse on Linux Mint, not Android.
Eclipse will happily import the main src tree of java files and show them as available packages. For example, I can get all the packages under zxing/core/src/main/java to show up; I can import classes from those packages and compile them.
However, I can't seem to import the com.google.zxing.client.j2se package when I have the core packages imported, and vice versa.
If there is a way to write BitMatrix objects to files without using
com.google.zxing.client.j2se
that would simplify matters.
Alternatively, if there is some way to get Eclipse to import both sets of packages, that might be an alternative. I have already tried modifying the "filters" under the "properties" tab, on the theory that if I can use two filters, the first can pick up
core/src/main/java
and the second can pick up
/javase/src/main/java/
But that didn't work for me.
Suggestions are welcome. Thanks.
Ran into the same problem with the import. It appears that we both forgot to add the javase.jar into the project. Download it from here, import and you will be able to import MatrixToImageWriter.

NetBeans importing classes package problems

I have created a class in Java that I need to import into NetBeans and use in a GUI. What I have done so far is add the jar file containing the classes to the library in my project. I can look inside the jar file and see the classes I need inside the . I have looked around online and know that the best to way import these classes is to move them to another package that isn't the .
My problem is that I do not know how to do this. I saw that I can create a package in netbeans, but it is gray when it appears and I can't seem to do anything with it. I basically have no idea how to create packages that I can use to import classes If someone could please walk me through step by step I would greatly appreciate it. I have looked at the other posts on this site and other places online, but they seem to skip over somethings I am not sure about. My teacher didn't mention anything about packages either, so I am really in the dark.
You can copy your source files (*.java) in your project's src folder, then use refactoring to change the package.
Right-click your java file, then select Refactor > Move and type your new package name.

GWT maps v3 missing drawinglib?

I have gwt-maps-3.0.2b.gwt22.jar, but I wanted to test code from http://code.google.com/p/gwt-maps-api/source/browse/trunk/Apis_Maps_Test/src/com/gonevertical/maps/testing/client/maps/DrawingMapWidget.java. I have problem, because my IDE saied me unknown imports:
import com.google.gwt.maps.client.drawinglib.DrawingControlOptions;
import com.google.gwt.maps.client.drawinglib.DrawingManager;
import com.google.gwt.maps.client.drawinglib.DrawingManagerOptions;
import com.google.gwt.maps.client.drawinglib.OverlayType;
I dont know to find some documentation. I dont understand that Do I need some another libraries or jar files ? How do I use drawing libraries in GWT Java ?
The JAR file you have (gwt-maps-3.0.2b.gwt22.jar) is from this project: gwt-google-maps-v3. However, the sample code you are trying to use is from this project: gwt-maps-api. These are different projects and the example from gwt-maps-api won't compile against the gwt-google-maps-v3 library.
If you really want to use the example code from the gwt-maps-api project, you will need to also download the rest of it as a library and import it into your project somehow. This is probably going to be hard since the library is only in an alpha state currently, and the author has not packaged it yet.

How to create .jar from specific package (without main) in Netbeans?

There are a lot of similar questions, but none for this specifically. I have a Netbeans project with a bunch of packages. Only one has Main. I'd like to be able to create a .jar from just one of the packages (and all the classes it contains, of course), which doesn't have main.
Is this feasible without having to put that package in another project or without having to screw around with build.xml? If the latter, any easy way or good rtfm links?
The point is i'm developing part of an application for college, each group member is developing a module of sorts. If each could provide their .jar the main project can just include jars and use them. I'm guessing all the mains in the jars wouldn't really hurt? But still...
You can use the project properties to customize your project's jar file content. This screenshot shows what it looks like for a Java Class Library project.