How to change Java Build Path for Android in Eclipse? - java

I'm having a build problem with a specific file that I'm not being able to change the path on my Android project. Here is a picture of the problem:
How do I change this Path: /Users/apple/Downloads/dolphin_player/p/libs shown in the picture?

Change it from the libraries tab. You cannot do it from the order and export tab.

On the libraries tab, remove or edit it.

Its very simple, just follow these steps,
Right click on your project, select properties,
From the dialogbox select "Java Compiler" in left part, see image

It depends on the which version of java you are using.Just go to library tab and do following.
If you are using the 1.6 version of java the whenever you want to add any third party jar files you have to add it by adding external jar file in the library option.
If you are using the 1.7 version of java then you have to make a folder called libs and put the all the external jar files in this folder. It will automatically add the files to yous build path and add it in "Android Dependencies".

Related

What is the "right" way to add libraries on Netbeans?

I'm a using Netbeans 8.1 to code in Java, when I want to add an external library (such as XStream, JDateChooser, etc) I find the .jar online and I add it to my project through the right clicking in Libraries --> add JAR/Folder.
After this I write my code and everything works fine until I finish my project and I want to export it into a .jar with Clean and Build
I think this maybe because I give an absolute path to the libaray instead of a relative one but I'm not sure.
PS: The library that I'm having trouble with is XStream 1.4.7
All the libraries included should pack in a jar file after build. The simplest approach is to click right on your project, select Properties and The project properties. In the new window opened find Categories and Libraries. The in the right side you may see the button Add library/JAR. Probably it's the same way.
Also you can create a Maven project and import all the libraries through dependencies.

Eclipse & Spigot - Trouble attaching source

I've been trying to find a way to attach source into eclipse. I built the spigot.jarand decompiled it into a zip file using JD. Here is the file if you want to take a look at the zip. Now what I'm having trouble doing is attaching the source to a project in eclipse. Yes, I of course have it in my build tools,
but I want to inspect some class' to see if I am using sockets/packets correctly. Here is the picture that eclipse gave me. I've already attached the source to that zip, but it wont work.
Any ideas?
You need to add the built jar file the buildpath of your project. In eclipse just right-click your project, click on "Properties", select "Java Build Path", select the tab Libraries and click on the button "Add External Jar" on the right side. Then choose the Bukkit/Spigot jar file you want to work with and build against on export.
If you need a detailed video tutorial on it:
https://www.youtube.com/watch?v=7dyopdta7ZI

How to add native library folder to existing project in Netbeans

I have some native files. I need to load those into my project. How can I do so in Netbeans?
I'm loading them with:
System.loadLibrary("SBXPCJavaProxy");
This is pretty forward in Netbeans:
Right click on the Project.
Select Properties.
Click on RUN.
In VM Options TYPE -Djava.library.path="[dir]".
Press Ok.
Basically you give directions to the compiler in which folders to search for available packages.
Note that [dir] should be an absolute path to the folder containing your natives. For example, if your natives are in C:\Natives then [dir] should be C:\Natives.

How to install jar library?

I've downloaded the ANTLR Java runtime libraries. It's a jar file. It contains "org.antlr.runtime". Where do I put it so that the Java compiler can find it? Do I need to extract it? I'm using NetBeans (for now), if relevant.
Assuming you can find your jdk folder, You can move the .jar file into the jdk\jre\lib\ext folder, where other .jar files are placed. After doing so, NetBeans should be able to run files with access to the library
For NetBeans you go to your Projects Tab and then right-click on the project you want the library added to then click Properties. Go to the Libraries bullet then on the right side click on Add JAR/Folder. No need to extract it. All you have to do is right click in the editor window and click Fix Imports.
For use outside of NetBeans you have to add it to your Java classpath.
For java command line you need to add it to your class path however in Netbeans you just need to add it as a library. It can be anywhere. Google to find out how to do these things.
In fact in netbeans, you can just say you need this in your maven project and it will do the download of the jar and its source/documentation as required.

Java API in eclipse

Im new to eclipse , can anybody tell me how to use an JAVA API in eclipse. or share any sample Java API.
Yes, how to use JavaDoc file in eclipse.
Yes, how to use JavaDoc file in eclipse.
You can download the Javadoc jar file from the respective project and include it in your build path
Eclipse==> project-->properties-->Java Build Path-->click on the jar file--> edit JavaDoc
Point it to the API URL location/Downloaded Jar file,
Typically, shift + F2 opens the API when the class is focussed upon
Do you mean: how to use a third-party Java library in your Java project in Eclipse?
Right-click your project in the Package Explorer and choose Properties. Go to "Java Build Path". Click "Add JARs" or "Add External JARs" to add the JAR file(s) of the library to your project.
"Add JARs" is for adding JAR files that are in your project directory. "Add External JARs" is for adding JAR files that are not in your project.
Note that the Eclipse help (Help / Help Contents) contains a lot of information, including information on how to work with Java projects in Eclipse and how to add libraries to your Java project.
Here are some nice Eclipse video tutorials . The version of Eclipse is dated ( 3.1 ), but the concepts are still there.
I'm not clear exactly what you're after, but if you create a new Java project, you will have access to the JRE system library's contents as a classpath container.
File->New->Java Project, enter project name, select OK.
You'll then be able to create new classes and access the Java classes.
If you want to reference another jar containing the "API", you can add it to the project's build path.
Say the jar is in the "lib" folder of your project, open the project properties (alt+enter), the Select Java Build Path, then the Libraries tab, select Add JARs..., then browse to the lib folder and select the jar you want to add and select OK.
To attach sources and javadoc to the jar, you can expand the selector in the Libraries tab, click on Source attachment and Edit... and browse to the location of the sources jar/zip, repeat for the Javadoc. The screenshot below shows you the Source attachment option for rt.jar
(source: vogella.de)
and ok back to the workbench.
You should now see that the jar is included on the project's path (the jar has a little overlaid icon on it).
If this is not what you're after, can you rephrase the question?
what you need to do is to hover mouse over some in-built method or class that are using in your program. Hold ctrl on your keyboard and click. Then eclipse asks you to attach source. click on 'attach source', browse for src.zip file after choosing 'EXTRENAL' file. or instead give path for extracted src folder under same ie external file attachment. Next time you hover over an in-built class or method it shows a small description. To view entire javadoc for same, keep holding ctrl and click on it. It worked for me.

Categories