I'm trying to add an embedded database to my application, but I have no clue where to begin. So far I've found that I should download the sqlite-jdbc driver and add the .jar to my project. From there I'm kind of lost, are there any good tutorials to get me started or some helpful tips?
Also, I'm using Eclipse for my IDE, so if there's anything within there that will simplify the process, feel free to add that as well!
You want dependency management here? Read up on Maven (very easy), write a Maven pom.xml file and load it into Eclipse that way. Eclipse and NetBeans understand Maven very well now. No need to learn an Eclipse-specific way to do this since Maven will work as well in NetBeans as Eclipse and is simple to run on the command line too.
Based on what search.maven.org says, your dependency in Maven would be this added to a standard pom file to get the latest:
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.15-M1</version>
</dependency>
Related
I have researched the internet extensively but still cannot figure out how to properly import a GitHub source code library into my java project in eclipse and use it successfully. I can do this perfectly if the library is in a jar format, but I don't know how to do it with source code provided in GitHub. I have tried everything from maven to downloading a zip file with the source code and manually putting it in my code (I know this is terrible practice). It seems like the library I am downloading references other libraries and this chain seems to go on for a long time.
I have had trouble with all libraries but this one is an example: https://github.com/thiagolocatelli/parse4j
I am relatively new to this kind of stuff, so can someone provide a detail step by step guide on how to do this?
Thank you so much!
Akarsh.
Download the parse4j github project into same directory as your project. Refer below screenshot
add <dependencies></dependencies> section of the pom.xml of your project, in the above image, it's jparse.
<dependency>
<groupId>com.github.thiagolocatelli</groupId>
<artifactId>parse4j</artifactId>
<version>1.4</version>
</dependency>
Now you will be able to use parse4j classes in your project.
This is a really basic question. I'm a college sophomore and I have no experience downloading APIs to use with Java, but I'm working on a personal project in which I need to be able to read in Microsoft Excel files. I'm trying to download Apache POI, which I saw recommended here. I might just be dumb, but I can't figure out where I should be downloading it to or how to verify the integrity of the files, which the download page says it "essential".
The download page is here: http://poi.apache.org/download.html#POI-3.17. If someone could just give me an idea of how to do this, that would be great, because I'm sure it's a skill that will help me in the future.
True. you are a beginner to world of coding. So try to take things one at a time and also would help if you inculcate good habits in the process.
To start would, would recommend to download an IDE (Integrated Development Environment), which would assist in you writing the code with ease. (http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/oxygen2)
Next google up about Maven (alternatives are there like gradle, ant etc.). Think of this as App store on Mac. You can give details about what you require and it will take care of downloading and putting them in your project class path.
Create your first Maven project in Eclipse (https://wiki.jasig.org/display/UPM32/Creating+a+Simple+Maven+Project)
Last add the POI dependency to your pom.xml file (configuration file where you define which java API's you want to download and use in your project, like a shopping cart for JAVA good). The maven dependency for POI is something like follows.
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
Now you are setup to have a good crack at your problem.
Just download the zip file, and uzip it. Then put the .jar file in on the Java classpath. A better option would be to use Maven or Gradle, and add POI as a dependency. This will auto download, and verify the dependency.
Maven Central - POI
Intro to Maven
Intro to Gradle
I need to add the package "uk.ac.shef.wit.simmetrics.similaritymetrics"
to my maven project but I am not able to find any remote repository which contains it. I have to add it via dependency to the project, but not successful yet.
-I already added the jar file to the referenced library but in that wat I get the following error:
package uk.ac.shef.wit.simmetrics.similaritymetrics does not exist.
-Adding it through following dependency to the Pom.xml also does not help
<dependency>
<groupId>uk.ac.shef.wit</groupId>
<artifactId>simmetrics</artifactId>
version>1.6.2</version>
<scope>system</scope>
<systemPath>LocalPath\simmetrics-1.6.2.jar</systemPath>
</dependency>
Any help is appreciated!!
If this is a small project that you intend to only build locally or on a few machines then the simplest way is follow directions at the site below to add a 3rd party jar. Those instructions will help you install it in your local repository. You will need to do that for all machines that you intend to run the build on.
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
If you plan to run it on many machines then the best thing to do is to install the artifact to your own private repository. If that is the case then I suggest you create a project for it in version control. Then upload the file as part of that project.
I appear to be the current maintainer of Simmetrics. You can add this dependency to your pom file.
<dependency>
<groupId>com.github.mpkorstanje</groupId>
<artifactId>simmetrics-core</artifactId>
<version>4.0.1</version>
</dependency>
Simmetrics has been given a much needed serious overhaul since 1.6.2. You may have to adjust your code accordingly. For source code and documentation see https://github.com/Simmetrics/simmetrics
I am following an online tutorial, and am stuck trying to get Spring libraries to run things with. The instructions are either a little out of date or assume I know how to do things in a Maven world that I do not.
They give web addresses on the Spring site from which they say I can "download the jars". But you can't download jars from any of them; evidently what you can do is find pom.xml fragments and use them to download jars. If you know how.
For example: the tutorial says:
Finally, following is the list of Spring and other libraries to be
included in your web application. You simply drag these files and drop
them in WebContent/WEB-INF/lib folder.
commons-logging-x.y.z.jar
org.springframework.asm-x.y.z.jar
org.springframework.beans-x.y.z.jar
org.springframework.context-x.y.z.jar
org.springframework.core-x.y.z.jar
org.springframework.expression-x.y.z.jar
org.springframework.web.servlet-x.y.z.jar
org.springframework.web-x.y.z.jar
spring-web.jar
I love the "simply" here.
I have many but not all of these (version 3.2.4). I have googled the library names and used jarfinder for the ones I don't have, but haven't found them all. It seems to me I'm flailing around a bit, just trying this and that until something works. I hate that.
I'm hoping someone can give me a set of steps I should follow when faced with this sort of thing, since we're faced with it all the time. Do I need to stop my current study of programming and learn Maven inside and out so that I can configure the bloody system so I can program again?
Is it a maven project you have?
If so in the pom.xml you just need to place the “pom fragments” in the xml.
i.e. between the dependencies tags. For example,
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
</dependencies>
Once you have done that run maven install. Under Eclipse it is: run as > maven install.
That will download all the dependences i.e. jars you have listed into the you local maven repository.
I think the default is C:\Users\yourName\.m2\repository
Found most of the needed jar files here:
http://www.java2s.com/Code/Jar/CatalogJar.htm
while I downloaded commons-logging here:
http://mvnrepository.com/artifact/commons-logging/commons-logging/1.2
My advice is, stop study you program language, Java I guess and learn how to integrate maven dependencies of Spring in your Maven project.
http://spring.io/blog/2009/12/02/obtaining-spring-3-artifacts-with-maven/
You cannot start the house from the roof
I've been working on a rather "standard" Java web application for a long time now. I develop in Eclipse using Eclipse's server plugin to run the app in Tomcat. The app's setup is straight forward: Spring for bootstrapping, Wicket for web, Hibernate for ORM, Maven for dependency management.
Today I have added Akka 2.0 to the project. I added it to my POM as per the manual:
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor</artifactId>
<version>2.0.2</version>
</dependency>
Maven finds the dependency and I can see it showing up in the Maven dependencies in Eclipse's package explorer. The referenced Scala Library also shows up (version 2.9.2 as it seems).
I can use the library just as one would expect: Eclipse finds the classes, I can jump to source files etc. Everything works perfectly. But once I start the app and it comes across any part of the program with references to Akka it throws a NoClassDefFoundError.
Since all other libraries still work as expected, my best guess is that is has something to do with the fact that Akka is a library developed in Scala. Since I've hardly used Scala myself though, I could not find any solution to the issue myself and Google isn't really that helpful when it comes to such generic exceptions.
Do you have any advice?
Verify that the required library (AKKA) is in your deployment assembly under Eclipse: open the project's properties and look for "Deployment Assembly" on the left.
[I'm using Eclipse Indigo]
You could verify the presence (or lack) of the expected jar file by examining the deployment under tomcat.