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
Related
I had a problem loading sound using the sound.processing library, so I am trying to use the ddf.minim library.
My Instructor imported the sound.processing library into processing AND Eclipse, and I don't remember how he did it. I tried going into processing and downloading minim from the sketch
When I try to import ddf.minim into my project, I get a red line under ddf. I also manually downloaded ddf.minim from github, removed the one previously installed, and I believe I had replaced it with the github files. I then went to add libraries in processing, and I still can't even import ddf.minim in Processing, let alone Eclipse!
Please help, I am just trying to get my sound to work in my Java project!
You need to add the Processing library and the Minim library to your classpath.
In Eclipse, to set your project’s classpath, right-click your project, and then click the Properties option. This brings up a dialog with all the settings you can specify for your project. Click the Java Build Path menu, and then the Libraries tab, which takes you to this screen:
This is your project’s classpath, and any library jars you want to use should be added here. Click the Add External JARs... button and select the .jar files that come with Processing. For basic sketches, I believe you only need the core.jar file.
Then for Minim, you can download the library .zip file from here. Unzip that wherever you want, and it should contain the .jar files that you need to add to your classpath.
Shameless self-promotion: here is a tutorial on using Processing as a Java library, and here is a tutorial on using Eclipse.
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.
I created a simple project using WindowBuilder in Eclipse and my goal is to send it by email. I don't know what kind of computer the person is using, so I exported my project into a 'Runnable JAR File' and checked the option 'Extract required libraries into generated JAR'.
The problem is that the generated JAR file is 20MB in size!!! The project has only one simple window - nothing complicated or fancy.
I found that some people use ProGuard to include only what is really needed.
I would like to know if there is a way to optimize it 'manually'? Are there libraries that are automatically included when creating a WindowBuilder project, and how may I determine which libraries I can remove?
Thank you.
I've had the same Problem using WindowBuilder. My solution was to look for the imports in my .java file, e.g.: import org.eclipse.swt.SWT;
In the Project Explorer in Eclipse you can see that there are much more imports than needed. Those 'Build Paths' can be removed carefully.
Simply rightclick on a .jar import like "com.ibm.icu_52.1.0.v201404241930.jar" and click on "Build Path" and "Remove from Build Path". Unfortunately, you can't remove or delete the packages inside the .jars.
But using this method, I managed to reduce the size from 20.7MB to 3.87MB. It's something...
Like fge said, send the source. Or upload the .jar to dropbox if you require you partner to access all of the files in the .jar.
If you don't like dropbox, find some other cloud storage solutions through a google search. Github or Bitbucket could also be an alternative to dropbox.
Cheers.
Use the Eclipse plugin FatJar. FatJar shows you which libraries are getting imported and allows you to specify which .jars, libraries, etc., that you want built into your JAR.
FatJar
Your jarfile is too big due of the project template. Create a sample java project, then use windowdbuilder components. Do not create a project Swing Template, by this way eclipse is gonna import all eclipse gui toolkits.
Tried it out with my way, my application's length equals to 3Ko against 24MO with the template project
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
Ok so there are tonnes of API's out there. I need to use some of them like JIntellitype, iText, docx4j etc. But the problem is I do not know how to go about it in Netbeans.
I tried following the instructions in readme for all these API's but it does not work since there is something I am doing wrong. I am a newbie at JAVA and Netbeans.
Thanks!
[Update]
This is what I tried to do.
I downloaded the JIntellitype API. It contains lots of files including JAR,DLL,CPP etc. When viewed through File->Open Project from Netbeans this folder is displayed as a project.
I created a new JAVA Application project from Netbeans.
I right clicked the Project->Properties->Library and added the API folder there.
Then I tried importing one of the classes from the API called HotkeyListener as follows:
import jintellitype.HotkeyListener;
I received an error saying package does not exist.
Generally you have to add your API jar to your project. Open project properties, find where external libraries are added and add them. Once you are done you can import library classes and use them.
like AlexR said, you should add the jar file with the jintellitype.HotkeyListener in it, not just the directory. You can open jar files with winrar, winzip, 7zip etc...
Regards