BaseX Access from JAVA - java

This is a very basic question, but I can't seem to find an answer. I've just installed BaseX (V.7.8.1 on Win7 PRO/64- bit) and have it running successfully through their GUI. I am now trying to run queries locally via their JAVA examples (from GitHub - specifically their RunQueries.java example). I've created a test project in Eclipse and placed the RunQueries.java code there to try to run it. But, the BaseX imports are not being resolved :
import org.basex.core.*;
import org.basex.core.cmd.*;
import org.basex.data.*;
import org.basex.io.serial.*;
import org.basex.query.*;
import org.basex.query.iter.*;
import org.basex.query.value.item.*;
Should the general install of BaseX put these packages in the correct place? If not, what do I need to do to find & get these package components properly into my directory structure? Appreciate any help.

You need to add the BaseX.jar file as an external JAR to your Eclipse project. You can do this by right-clicking on your project in Package Explorer, then Build Path > Add External Archives. I am assuming you also run their GUI from this JAR file, so you should have it. If not, you can download it here.
If you are also interested in the internal workings of BaseX; you can actually download their source from GitHub.

Related

Import processing.video.* on Intellij

I am trying to run a mp4 video in Java using Processing.
I'm trying to use Intellij IDEA, but when I try to import processing.video.* it doesn't find the video library.
Where can I find and how can I import this library?
You need to do two things:
Find the .jar files (and any other files) required by the library.
Add those files to your classpath.
You can find the library files in your Processing directory. For me mine are in C:\Users\kevin\Documents\Processing\libraries\video\library, but it's going to depend on your OS and where you installed Processing.
You can also build the library yourself from this GitHub repo.
Now that you have those files, you can add them to your classpath. Since you're using Intellij, the links in Slaw's comment should get you pretty far:
Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project
Working with libraries - Intellij

Create and import Java library in Eclipse

I have seen similar questions on SO and I'm just not getting it. I have a bunch of Java classes I need to import as a library. How do I make the jar file, save it in the right place, then tell Eclipse to import the jar file?
The classes I want in my library are here: StdIn library code
and this is the java code I want to import the library into:
Sattolo algorithm code
There is a further library I would need to import to make the Sattolo algorithm run, but once I get the general idea...
I am a very, very new Java coder, so please be patient with me not understanding what must seem very basic.
Step 1: create a jar from you classes, if your using eclipse then simply
https://www.cs.utexas.edu/~scottm/cs307/handouts/Eclipse%20Help/jarInEclipse.htm
Step 2: add the jar dependency to your eclipse project
How to import a jar in Eclipse

How to import source from GitHub into an Eclipse project

I am trying to use this tool from Google: https://github.com/pcj/google-options
In the example given by Google, they use:
import com.google.devtools.common.options.OptionsParser;
to allow their example code to use the command line parser.
When I do this, Eclipse says the referenced files don't exist.
I have tried putting the source file from google-options in a package in my project; no luck. I tried running Google's example, and it won't even compile. It can't find all of the classes in its own src folder.
Based on my research, I think there's either an issue with a .jar file needing to be in the build path, something to do with Apache Ant, or an issue with GitHub I don't understand.
I'm very new to GitHub; this is the first time I've tried to do anything like this.
You should first import this project from GitHub to your local machine. import statement in your class means that classes from other packages should be imported to this class you're working on. Import not from the remote source, but from local.
I figured it out. It needs the guava.jar file found here added to the buildpath. After that, it has a couple weird dependency issues with javax, but I just removed those (it was Nullable and Immutable, if anyone's interested).
First you must clone the project and compile it, to do that put the following commands:
Open your terminal and go to the workspace folder:cd {workspace}
Clone the project: git clone https://github.com/pcj/google-options.git
Compile the project: mvn clean install
Check the result, this should print: BUILD SUCCESS
In that step, maven will download all dependencies that the project needs.
To import the project: Launch eclipse, click on File /Import... choose Existing Maven project, browse your workspace where the projetc was cloned.
Create a class that extends OptionsBase and defines your #Option(s). For more information about how to use, see https://github.com/pcj/google-options#usage

implementing the NWalign.java alignment script for needleman wunsch algorithm

I'm trying to run the NWaling.java file found here. the code present at the link that I mentioned makes use of the jaligner library. I have downloaded this Java package from here. inside the zip folder there is a JAR file. I'm developing the code using eclipse. whenever I add this JAR file to the code there are some classes missing for example:
import jaligner.NeedlemanWunschGotoh;
&
import jaligner.matrix.MatrixGenerator;
also in the entire zipped folder there isn't any pom.xml file to allow me to import the entire folder as a maven project to eclipse. can somenone suggest me how to import this jaligner library and use it in eclipse? thanks.
You can download a community implementation of the jaligner algorithm from here.
Take a look at this project sources where you may perhaps find all the searched artifacts.
The full Eclipse project with the NWalign.java can be found here including .classpath file with all dependencies listed there.

Downloaded a Java library off GitHub, do I compile it now?

I am trying to do this simple tutorial using the JARVIS Java Speech API:
https://github.com/The-Shadow/java-speech-api/wiki/Hello-World
These import lines lead me to think that I need to link to a .jar library.
import com.darkprograms.speech.microphone.Microphone;
import com.darkprograms.speech.recognizer.Recognizer;
import com.darkprograms.speech.recognizer.GoogleResponse;
But when I go to the gitHub site, the only option is to download the .java source files. How should I go about converting them into a .jar? Is that what I am supposed to do?
On that same GitHub page, you can download the jar :
https://github.com/The-Shadow/java-speech-api/releases
You should also acquire any additional jar required by Jarvis (it doesn't seem there are any from a quick look).
That said, if you want the very last version of that library (and the associated bug/problems if any), then you will need to compile it from source, ie, something like :
clone the git repositery
compile the java sources
create the jar

Categories

Resources