How do I use the GTGE library? Java 2D games - import

I downloaded from the official site a zip containing a jar and a "docs" folder, inside there is a "com" folder and a "resources" folder. I want to be able to use this libray in my java IDE (eclipse) but when i type : import com.golden.*; it does not recognise the command.
How do I add this library so that I can actually use it with programming? Please be as specific as possible, as I seem to have a natural talent in failing to follow instructions.

Right click on your project
Select properties
Select the Java build path from the list to left side
Click libraries on the right side
Click on "Add external JARS"
Select your file

Related

netbeans how is it organized

i have a running package consisting of classes all written by myself, except of course for some basic java libraries. The reason is simple : everytime i try to import an external jar to use it instead of writing it myself, netbeans fails to find the files, so it simply does not work.
as you will understand, i'm really not happy with this situation, so i looked for a solution and tried everything to get external files being integrated in my package ...
So my question : does anyone know a site with a simple and clear explanation on how netbeans deals with the different files, and where they should be stored ? I've read all questions and answers about importing external jar files, but nothing helps ...
To use an external library:
Open the project properties
Click on libraries
Click on "Add JAR/Folder"
Select the jar file(s) in question
If a library consists of multiple jar files and you want to use that in multiple projects:
Open "Tools -> Libraries"
Click "New Library"
Add the jar files using the "Add JAR/Folder" button
Close the "Ant Library Manager" window
Open the project properties
Click on "libraries"
Add the global library by clicking on the "Add Library button"
The NetBeans manual has a lot of information on how to use the IDE:
http://docs.oracle.com/cd/E50453_01/doc.80/e50452/toc.htm
The chapter "Managing the classpath" describes how to manage external libraries:
http://docs.oracle.com/cd/E50453_01/doc.80/e50452/create_japps.htm#CHDFBFAD
The chapter "Creating Dependencies Between Projects" describes how you can re-use code from one project in another:
http://docs.oracle.com/cd/E50453_01/doc.80/e50452/create_japps.htm#CHDIBBEB

Importing a library into Android project (shared with SVN)

There's library that i want to use in my project. I have the project folder of the library so I followed these steps to add it to my project:
Execute "jar cf NameOfTheLibrary.jar *NameOfTheProjectFolder"
Create a new folder, named libs, in my Eclipse/Android project.
Right click libs and choose Import -> General -> File System, then click Next.
Browse the file system to find the library's parent directory (where I keep the generated jar file).
Click OK, then click the directory name (not the checkbox) in the left pane and check the relevant JAR in the right pane.
Right click on my project, choose Build Path -> Configure Build Path, then click the Libraries tab, then click Add JARs...
Navigate to my new JAR in the libs directory and add it.
Even if Eclipse doesnt notice any problem before runtime, when I start my application on my log (I use logcat) appears:
"Could not find 'pathOf.classOf.myImported.Library' referenced from method'path.of.the.method'"
How can I import this library in a way that i can share it with the project via SVN? I thought what I've done was enough but It doesnt seem so.

How to add a file as a link in Eclipse

In VS 2008 there is a nice feature that I can share a single file between two projects
How can i do the same in Eclipse (Android)
For Java, you can right click on the project and go to Properties then into Java Build Path. Under the Source tab you can click on the Link Source... button and then input the location of your common source directory - that will allow you to put all "shared" files in the one spot and link them into the projects you want.

Import Libraries in Eclipse?

I just recently downloaded the dom4j library, but for the life of me I have no idea how to access it. I dropped it in the plug-ins folder and rebooted Eclipse, without success. For some reason finding a straight answer for this is more difficult that I thought it would be.
No, don't do it that way.
From your Eclipse workspace, right click your project on the left pane -> Properties -> Java Build Path -> Add Jars -> add your jars here.
Tadaa!! :)
Extract the jar, and put it somewhere in your Java project (usually under a "lib" subdirectory).
Right click the project, open its preferences, go for Java build path, and then the Libraries tab. You can add the library there with "add a jar".
If your jar is not open source, you may want to store it elsewhere and connect to it as an external jar.
For the Android library projects, I do it as in the attached screenshot:
Right click the project, select Properties->Android and in the library section click Add. From here you can select the available libraries.
If you are importing a jar file, then importing them as jar or external jar, as other posters posted would work. I prefer to copy/paste jar file in the libs folder (create one if it doesn't exist) and then import as jar.
If you want to get this library into your library and use it, follow these steps:
You can create a new folder within Eclipse by right-clicking on your project, and selecting New Folder. The library folder is traditionally called lib.
Drag and drop your jar folder into the new lib folder, and when prompted select Copy Files.
Selecting the Project tab at the top of the screen, and click Properties.
Select Java Build Path followed by the Libraries tab.
Click the Add JARs… button and select your JAR file from within the lib folder.
Your JAR file will now appear in both the lib and Referenced Libraries folders. You can explore the JAR's resources by clicking Referenced Libraries.

Importing a library into Eclipse

I want to use Lucene in my project.
When I simply copy the .jar file into my project than I get the error "Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found."
How do I import a library like Lucene the right way in Eclipse?
You have imported it correct. You can use all the classes from the jar if you are that far. You can't display all the useful hints from the javadoc during editing and you can't jump into the code of the library.
You can add the source and the javadoc later on in your projects build path settings.
Right click on your project and select Properties
Choose Java Build Path
Now select Libraries (you should see the jar listed)
Click on the arrow of the library to expand its settings (You should see something like JavaDoc none and source attachment none)
Now if you want to add the source click on the source attachment none item and select edit.
Now supply the path information to the folder or the jar containing the source and click okay.
Do the same thing for the java doc