I know this has been hashed over a bit on here, but I have an issue that hasn't been answered. I am attempting to install Xuggler plug it into Eclipse. I have no issues with the idea of adding it to my classpath, my issue is with getting my hands on the actual xuggle-xuggler-5.4.jar file. I've installed the one from the website, but there is only a zip folder, and not a jar file. I even tried to pack the file into a jar myself, but Eclipse wouldn't take it. I've looked everywhere in that zip folder and I haven't seen a jar file anywhere. Should just use the zip folder, or did I mess something up? I saw something where a guy had a xuggler file in his Program Files, but I don't have that.
EDIT:
I've been to the googleCode site given on the Xuggler website, and I've clicked on the one that says xuggle-xuggler-5.4.jar. For some reason, though, when I do this, it tries to install as a zip folder, not as a jar. Then it doesn't work in my classpath. When it installs as a zip, like it does in my case, there is no xuggle-xuggler-5.4.jar file on my computer. Instead, the file that was installed is now xuggle-xuggler-5.4.zip.
I don't use Eclipse myself, so I'm not familiar with your particular problem. I do use Xuggler however, and have successfully used the JAR found on their website. So here's just a couple of quick hints. I apologize if I am telling you things you already know.
You can find jar-builds for Xuggler here. Somehow they chose to hide the link on their website somewhat.
There have been previous questions on StackOverflow, such as this one, regarding instructions to add a JAR to an Eclipse project, which will automatically update the classpath and include the JAR during build.
JAR's are in a format that was extended from ZIP, as can be read here. It is unfair to say that JAR files and ZIP files are the same, but you could open a JAR file like you would a ZIP file and read (some) of its content.
Xuggler clearly states this on their website, but I missed it myself, so I thought I'd mention this. The xuggle-xuggler-5.4.jar can be used on any platform. Depending on the codecs you will be using, you might need some additional libraries. To save some disk space you could use xuggle-xuggler-noarch-5.4.jar and an appropriate xuggle-xuggler-arch-xxx.jar as a replacement for xuggle-xuggler-5.4.jar.
Related
I have a Maven project. After I make changes to the project, I package the project up into an Uber Jar file and upload that to my backups. I am wondering, if my computer were to break or I lose all the code to the project, can I get the project back using only the Uber Jar file or would the project be gone forever?
How can I open this Jar file as a project and view all the Java code inside of it?
It would be entirely gone; that jar file contains only class files, not your source files, and you can't 'recover' source files from class files (you can decompile them which is mostly useless for this purpose; all comments, most names, most structure - all gone. You can't feasibly continue your project with this).
As it isn't in there, it's not possible to 'open a jar file and see all java code inside it'.
You'll need to set up backups.
The proper way forward is to first set up version control; this ensures that you don't just have a backup of the latest state of your source files, but every state of it - you can travel back to any time. Protects against code you deleted by accident, and means you can freely remove code you think you no longer need without that nagging feeling of: Yeah but what if.... maybe later? - so stop commenting out stuff you don't need, just get rid of it. It also means if there's a bug, you can time travel to the exact point in time when you added the line, and you can review the changes made by others in a project (presumably you're writing this on your own for now, but at some point you'll work with more people than just yourself!)
Read up on git which is the version control system that 80%+ or so of the community uses, probably best not to spring for exotic options if you aren't familiar. There are a billion tutorials out there to find if you search the web.
Host your git on a site like github or bitbucket which therefore also takes care of backups. Alternatively, host it on your own server (it's not complicated; git is open source). If you can't do that either, just let git write to a local directory and then use e.g. backblaze or something similar to ensure that file is backed up.
Yes, you can view your code by using a decompiler. I have experience mostly with IntelliJ, and this IDE includes a decompiler of its own. In case you lose everything and have only the jar file. You can use this included decompiler to get your source back from your .class files. But instructions on doing that are a story for another question...
If you want to secure your code use GIT. A version control tool that is a must when it comes to programming. Google about it and after a few days of playing around with it, you will never worry about such things.
Right-click on your project.
Select Build Path.
Click on Configure Build Path.
Click on Libraries, select Modulepath and select Add External JARs.
Select the jar file from the required folder.
Click and Apply and Ok.
So I have a .java file which, for example, uses the OpenCSV dependencies. I use these dependencies via the .jar files within Eclipse and link the build path, rather than typing them in via the pom.xml file. I assume this produces the same output, being able to use the libraries, but I just want to cover the bases. I am attempting to email this .java file along with dependencies to a possible employer, but I am having trouble emailing it at all. I found out you apparently cannot send a .jar file via email, so I tried to pack all the dependencies and my .java file into a Executable JAR file (and just a normal JAR file) and they still wouldn't send. Then, I tried to change the file extension to something like .jpg, and even .jpg.zip, still to no avail. Does anyone know how I could send these over? I was hoping to send them with the dependencies, but I feel like at this point I will need a README file with the dependencies needed to be downloaded, which kinda sucks. Thanks in advance for any assistance!
I found out you apparently cannot send a .jar file via email, so I tried to pack all the dependencies and my .java file into a Executable JAR file (and just a normal JAR file) and they still wouldn't send.
I can't pack explosives in my suitcase when I fly, so I decided to pack an even bigger bomb, and for some bizarre reason they wouldn't let me fly with that, either.
(If you cannot mail jars, you cannot mail jars. You cannot obviously solve this problem by messing with how you pack the jar!)
I use these dependencies via the .jar files within Eclipse and link the build path, rather than typing them in via the pom.xml file.
Type them into your pom file.
Then, I tried to change the file extension to something like .jpg, and even .jpg.zip, still to no avail.
I tried to tape a sticker that reads: "Hello! I am a teddy bear and most definitely not a bunch of explosives!" but airport security didn't fall for it.
(gmail and friends are not complete idiots. Stop trying to mail a jar file to a service that does not allow you to do so).
The industry standard way to 'mail' a project is first to have a project that can in fact be distributed. What you're trying to pull is to combine the sources, but not in a state that the recipient can actually compile them, along with some half-baked distributable. This isn't going to work: Pick a side. Either [A] just ship sources (just the java files, and the pom), or [B] just ship the executable, which you don't email - put it on a site someplace. Given that it's heading for a potential employer, they obviously want door number one: sources.
Put your project on github or some other public source repository. If you aren't using source control, that's a big problem and will likely lead to your employer having an issue with hiring you - it's industry standard, time to learn. It's not particularly difficult.
Next, ensure the project as is builds cleanly on a clean system. That means it is high time to stop handrolling your deps in an eclipse project: You evidently know what maven is, so use maven as it is meant to be used; put the deps in there. You want a readme file, but all it really needs to contain is something like:
(Short explanation of what your application does)
To build and compile this project, ensure java and maven are installed on the system.
(at least java11), and run:
mvn compile
And then you mail then the link, so, https://github.com/cardinalsfan13/myproj or whatnot, and nothing else.
If your arms itch when I mention 'put it on a public repo', then you can still mail the sources (so, pom.xml, java files, and not much more), zip em up. email itself can handle jar files just fine, so either your mail service, or theirs, is detecting them and denying your email. Zip them up with a password, or use a file mailing service then. These are significantly worse options than mailing a link to github or some other source repo hoster, though.
Often I find that I have a set of JAR files configured as libraries in one Netbeans project and I need the same (or a subset of) those JAR files in another project.
All of the ways I've found to do this so far are very long winded and painful so I am hoping I've missed something simple.
Google found a 6 year old feature request and nothing else really useful: https://netbeans.org/bugzilla/show_bug.cgi?id=118325
At the moment the ways I can think of are:
Create a "Library" for the set of JARS and then use that library in each project. This is probably the neatest way to do this but still involves a lot of steps and seems like massive overkill just to copy a few JAR file references!
Go to source project, right click JAR, select edit. See the library classpath in the popup window. Close window, go to the destination, select add JAR. Can't cut and paste in path so have to hope you remembered it right. Browse to JAR file, add it - repeat for any other JARs that are not in the same folder.
Frustratingly the tooltip that comes up when you hover over the library contains exactly the path you need to add the jar - but there is no way I can find to copy the contents of that tooltip!
This is all made much more painful by the fact that all the windows are modal, you can't cut and paste the path out because it doesn't actually copy as a real path, etc.
All suggestions welcome as this is becoming a frequent annoyance at the moment!
I just found this old question while searching for an answer to the same problem. I Couldn't find any other useful results so I copied the libraries in the nbproject/project.properties file to the same place in my new project.
The only references I found in the whole directory were like this
file.reference.commons-lang3-3.8.1.jar=D:\\Documents\\javaLibraries\\commons-lang\\commons-lang3-3.8.1\\commons-lang3-3.8.1.jar
file.reference. [.....many more]
includes=**
jar.compress=false
javac.classpath=\
${file.reference.commons-lang3-3.8.1.jar}:\
[....many more]:\
This part was just in between what I wanted, so I copied the whole thing but it was the same in the new project.
includes=**
jar.compress=false
So far it's all working fine. You could back up the project.properties file but I already had one nightly.
edit:
You can also copy over the javadoc and sources by copying the lines like
javadoc.reference.commons-lang3-3.8.1.jar=D:\\Documents[more path....]javadoc.jar
source.reference.commons-lang3-3.8.1.jar=D:\\Documents[more path....]sources.jar
I downloaded and installed a fat-jar eclipse plug-in to be able to package my project containing an external library(JMF). But when I run the application, it says "No device found". Does this mean that jmf.jar wasn't included in the new jar file since it can't detect the webcam? Because when I'm running the application in eclipse, there is no error and it can detect the webcam without any trouble.
How can i solve this problem?
No, "No device found" is a typical JMF response - it can't seem to find a video/audio input or output device. So I think JMF is indeed in your jar and is simply complaining.
Is it possible something is missing from your packed-up classes? Something that is on the classpath in Eclipse but not included in your big jar?
Update
I just remembered where the problem may be: For performance reasons etc, JMF uses native code; installing JMF installs DLL's (Windows) or .so's (Linux/Mac?). I'd guess that JMF is having some trouble finding these components when you make such far-reaching changes to its classpath.
I believe there's also a software emulation driver available. Can you try working with that and seeing if it works OK from the jar?
I had this same problem just now, don't know if you have done this but I solved it by adding the jmf.properties file to the same directory as where your .jar file is located. You can find jmf.properties in the lib directory of the JMF installation directory. Just copy and paste it.
It may be that fatjar uses static code analysis to figure out what class files wind up in the generated JAR, and that the JMF is doing dynamic techniques to load classes from other jars based on a registry of some sort. One way to find out is to run your application with the -verbose:class switch, and then sift through the output to see which class or classes failed to load.
I found a post in the Sun forums where someone else was having trouble with JMF. One responder suggested:
try FMJ (http://www.fmj-sf.net/) or gstreamer-java (http://code.google.com/p/gstreamer-java/).
It's possible (though of course hardly guaranteed) that switching media framework products could be a solution.
Please make sure your jar path, jar path should not be some other path like D: or E: , it should be jmf Installed directory like C:\Program Files (x86)\JMF2.1.1e\lib\jmf.jar. Hope this will help you.
I just downloaded Eclipse several hours ago, and needed to add Java3D to the classpath. Installing it went without a hitch, but Eclipse can't seem to find the documentation folders so that it can give super-IDE functionality, such as autocomplete and method signatures.
While I know how I would add them individually, this lead me to the question; what is the "correct" way to install a Java library in Eclipse? Is there a special directory format I should follow? Is there a plugin that already did this for me? (The answer to that is yes, but I don't know how to use it, or whether or not it's appropriate).
Thanks!
Edit 1: It seems to me that someone down-voted the question. May I ask why?
Edit 2: So after monkeying around with the JARs, it seems that manually setting the doc path for each JAR in the library seems to be the least-error prone way.
when you add a .JAR(library) to your project in the LIBRARIES tab for your project, you have the option of attaching the javadoc directory for the jar.
So, go to the LIBRARIES tab of the "java build path" for your projects. select your jar. expand the (+) sign and you will see that you can set the javadoc. path.
good luck,
I think I've got it (had the same issue as you). Better late than never.
Go here - http://java3d.java.net/binary-builds.html and download the documentation zip (j3d-1_5_2-api-docs.zip).
Extract the directory anywhere on your HD (Right in the Java3d folder is fine).
Link the Jar's JavaDoc listing to that Folder (java build path >> Libraries >> expand the Jar Listing >> JavaDoc Location >> browse to the folder location, then validate). Do it for each j3d Jar.
That should integrate the J3D Javadoc.
As far as I know (haven't used 3.4 very much thus far), Eclipse has two options for the automatic showing of Javadocs. The first is a JavaDoc jar to attach to the jar file. The second is having the javadoc in a source jar which is attached to the jar to show the source.
A directory, if I recall correctly, will not provide autocompletion of javadoc. However, if you press "F1", you will be able to access the javadoc via the help menu.
You might try placing the documentation directory into a jar file, and attaching it to the jar file and see if that tricks Eclipse.
I cheat; All my java projects are built with maven, so I use maven to generate an eclipse project, with classpaths etc already setup, with a simple 'mvn eclipse:m2eclipse'.