first of all, thanks for all the times this comunity helped me, and sorry for my english.
The problem: I want to use a public library for the RIOT games api, this library:
https://github.com/aaryn101/lol4j
When i tried to add the library eclipse don't recognize the classes!
I dont't know how to add it!, i searched, really, but i can't find it, thanks!
pd: I'm using Eclipse!
Here is an example from the library:
Lol4JClient client = new Lol4JClientImpl("apiKey");
ChampionListDto championList = client.getAllChampions(Region.NA, true);
RecentGamesDto recentGames = client.getRecentGames(Region.NA, 19163557);
Map<String, LeagueDto> leaguesData = client.getLeaguesData(Region.NA, 19163557);
PlayerStatsSummaryListDto playerStatsSummaries = client.getPlayerStatsSummaries(Region.NA, 19163557, Season.SEASON_3);
RankedStatsDto rankedStats = client.getRankedStats(Region.NA, 19163557, Season.SEASON_3);
MasteryPagesDto masteryPages = client.getMasteryPages(Region.NA, 19163557);
The library hosted on github contains a gradle build script that you can use to build a jar file. If you don't already have gradle download it from http://www.gradle.org/installation and configure it.
Extract the ZIP
Rename junit.properties.sample to junit.properties and enter values for variable defined within the file.
Assuming you have access to a terminal or the command line, run the following command from the lol4j-master folder: gradle jar
You should have something like the image below. Then you can import the jar file the normal way into your project.
PS: This method will save you the headache of downloading the necessary libraries.
Running the command: gradle jar:
tshenolo$ gradle jar
Download http://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.3.0/jackson-databind-2.3.0.pom
Download http://repo1.maven.org/maven2/com/fasterxml/oss-parent/11/oss-parent-11.pom
Download http://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.3.0/jackson-core-2.3.0.pom
Download http://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.3.0/jackson-annotations-2.3.0.pom
Download http://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-client/2.4.1/jersey-client-2.4.1.pom
Download http://repo1.maven.org/maven2/org/glassfish/jersey/project/2.4.1/project-2.4.1.pom
Download http://repo1.maven.org/maven2/net/java/jvnet-parent/4/jvnet-parent-4.pom
Download http://repo1.maven.org/maven2/org/glassfish/hk2/hk2-bom/2.2.0-b21/hk2-bom-2.2.0-b21.pom
Download http://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common/2.4.1/jersey-common-2.4.1.pom
Download http://repo1.maven.org/maven2/javax/ws/rs/javax.ws.rs-api/2.0/javax.ws.rs-api-2.0.pom
Download http://repo1.maven.org/maven2/com/google/guava/guava/14.0.1/guava-14.0.1.pom
...
BUILD SUCCESSFUL
When you download a ZIP you are probably downloading the full project sources, project, etc.
You need to either extract that to your hard drive and then load the project in an appropriate IDE and build it or look and see whether the project you are downloading offers a JAR download.
Either way what you need is a .JAR file either downloaded or produced by building the project. That JAR file can then be imported as a library.
In Github, you can download the master copy (Download Zip).
Steps to add to eclipse:
This will include the classes in your project
extract it
copy the folder "lol4j" under lol4j-master/src/main/java to your project folder's src/
refresh the project
In the same project, in your classes, you can already use the api provided.
import the necessary classes when you see error (by Ctrl+Shift+O or right click the red cross)
some dependency jars are needed:
e.g. com.fasterxml.jackson.*
you may need to import those dependency jars (by download from google) to the project as well by right click the project ->
edit Java build path -> Libraries -> Add External JARs -> browse and add
P.S. I have tried myself in Eclipse, and it works
Related
I tried importing google-play-service library, but it shows me the message below.
It's the Path:
IT's the message:
What did I do wrong?!?
Hey,Try this way,hope this will help you to solve your problem
Copy your google play service from eclipse and paste in same derive of your system where you create project, then check.
if it not work then create new workspace and check. sometime it make app by default and said there is no project.
Checkout and tell me if it work or not
You just Import the project Sdk/extras/google/google_play_sevices/libproject/google_play_services_ib/
dont go beyond this path, just imort this whle projest.
Note: While importing or attaching lib project with your project then take care of one thing:
If path appear on import starts with a drive letter(C:, D: etc) then ,it means import not successful, it should be start with dot (...)
The library project should be on same location where your project is (for successfull import.) while it is in workspace on at any other location.
try to paste it in directly in your workspace and if you simply wants to add jar files then use buildpath option for particuler project.
Ok the deal is, I've made a small class library (*.Jar file) to help make a more visually organized code and to help with some common tasks.
Before you tell me to go to: Tools > Preferences > Libraries.
I have done that, over and over and over again.. I also tried to manually add it to: C:\Program Files\BlueJ\lib\userlib\"jar file here"
And yes, i did restart BlueJ to load the newly added libraries.
No matter what i seem to try it won't let me import it to my project using the import command, but without it, it just won't compile.
I know i can just add the classes manually, but as the class library slowly grow, so does the effort of adding all the classes in that library.
In advance, thanks for your help and consideration.
If adding your jar file in the Preferences > Libraries tab doesn't work, you can try adding the jar to the "userlib" directory at <bluej-dir>/lib/userlib (where <bluej-dir> is the folder where BlueJ was installed).
A third option you can try is adding your jar file directly to a project by creating a +libs directory inside your project directory and copying the jar to that directory. This has the drawback that you have to manually copy the jar to each project +libs subfolder that needs your library. On the plus side, it allows you to distribute your project (library jars included) just by zipping up the root project directory.
On Windows I create directory named "+libs" on my blueJ project directory,
then add .jar to that directory, and restart blueJ ,
that´s help me, and import after that work fine
Despite the post's oldness for who stumble upon i can say with the newest version of BlueJ (actually 4.1.3) in an old Ubuntu distro(Lucid Lynx aka 10.04LTS) all work as intended per default without any hack
I have one jar file. I want to see the source code of classes of this jar file and i need to use source code of this jar file. Is there any option to view and use that jar file source code?
Is there any option in eclipse to extract jar file and to see the source code of that jar file?
if you add a jar as dependency to your project, you can also link sourcecode to it.
Rightclick on project->Build Path->Configure Buildpath. There, choose the jar that you linked into your project, extend it and under "source attachments", you can add the jar that contains the sources of this specific jar
You can add the JAR file with the byte code and attach the source JAR as well. You can't do without the first; the second is optional.
It's easy to do in IntelliJ; I'm not sure about the steps in Eclipse.
Right click on Your procjet. Chose properties.
Select Libraries
Chose Your jar
Profit
The JAR file you are refering too may not have source code attached.
Usually, when downloading third party library you can download JARs with byte-code and source code separetredly. The best way to check is to simply extract JAR file (with ZIP extracting tool) and check whether you have source there. If so, you can do the following:
1. Add the JAR to your Eclipse project (just drag it there and choose whether you want to copy or link to the JAR).
2. Whenever you are opening class file that does not come with source-code and you are shown "Source not found" page - just press button "Attach Source.." and find your JAR file with source code.
[EDIT] use JD-GUI to extract source code (*.java files) from *.class files contained in JAR file.
In my case I had in Java Build Path Source attachment with meaningful path (not NONE), but file itself was absent in this place. I configure project to Maven nature. And then from Maven make Download sources - file -source.jar appears.
Yes,You can see the source code of all the files those are added in your jar file.first you have to add jar file same as shown by the Marcin Szymczak. and after that click on "Referenced library". After that click on Your jar.and you can check all the classes source code.In my case jar file-Hackerrank.jar and you can see source code of classes:
This applies to plugin jars (if that is your case):
Ensure to put the jar into your target platform folder
Refresh your target platform: Window -> Preferences -> Target Platform -> Select your current target -> Edit -> Finish -> Reload -> Ok
Open the "Plug-ins" view: Window -> Show view -> Plug-ins
In that view, locate the new plugin jar: right click and Import As -> Source Project.
You will have it as a plugin project in your workspace.
I downloaded an API but there is no jar file in it. It has the packages(folders) and the source code. I tried adding this in various ways in Eclipse but still I don't get the "import ...." when I press F2 on the underlined red classname. I have added projects and Jars in Eclipse all the time and it has worked. Since this is the source code should I take any extra steps in order to make it work?
Regards!
If the source is available to you (.java files) you must create a new source folder, then copy the source tree (root package e.g. the folder com or org) into the new source folder just by using a standard file explorer and copy&paste:
Edit: You could add the source files to your existing source folder as well, but I'd avoid that. Best solution would be to create a separate Java project containing just the source files of the external library. You also need proper code management, so that you do not accidentially make changes to the external source files!
You may create jar from the classes you have received in API packaging and place that jar into the classpath of the project
Enjoy !!!
am trying to encode the values given in an Text View into an QR code at the click of a button.
i downloaded zing 1.6.zip and don't know which one to import among all the folders for my process
i try with this website http://www.onbarcode.com/products/android_barcode/barcodes/qrcode.html
but nothing went good with it, what class files i need to import in order to execute the above code
Add the OnBarcode.AndroidBarcode.jar file to the libs directory of your android project.
Then make sure you add it to your classpath. If you're in eclipse, you can paste the file in the libs directory. Then right click it -> Build Path -> Add to Build Path.
At that point you can start using it:
QRCode barcode = new QRCode();
And again, in eclipse, as long as you have the jar file on your build path, can do a ctrl+shift+O to fix imports and pull in the correct class imports.