I just heard of library for reading/writing excel files without COM, so I figured I'd go check it out.
I downloaded jexcelapi_2_6_12.zip from this page http://sourceforge.net/projects/jexcelapi/files/ but I have no idea how to open it in Eclipse.
I know it's a silly question, but I'm sure it's not the first time someone's asked it, how do I open this in Eclipse in Windows, compile, run and debug it?
Primarily what you need from that zip is the jar which contains the library. You'll still need to actually write a Java app that uses it.
So what you need to do is:
Unzip the file you downloaded
create a new java project
add a lib directory to the project
copy jxl.jar from the zip into your projects lib directory
right click on the jar in eclipse and select "Build Path>Add to build path"
The classes in the library are now available to your project
Next create a new java file in your projects source folder and start coding.
Extract the zip file somewhere, put the jar file in your project's directory somewhere (e.g. under a lib directory) and then right-click on it and select "Add to build path" or something similar.
It's not runnable on its own though - you'll need to write some code in order to debug.
If you want to debug into the source code of the library itself, you'll need to tell Eclipse where the source is - but that's unlikely to be necessary.
Related
I'm getting my java project to a finish and I'm about to export it to an easy useable program on the desktop.
In my program I'm using .txt files to keep all my data, so I've made a folder for my databases and my images.
The problem comes when I'm exporting the project to the desktop and it looks like everything mashes up and becomes one big pile of files instead of a folder structure I made it like in eclipse.
From eclipse
What is the right way to export the project, and how does I keep my filestructure?
Exporting to JAR file at the moment.
EDIT:
I'm also getting this error when I try to follow exampels from the internet.
'Utforsking/src/org/eclipse/wb/swing/FocusTraversalOnArray.java'
You can choose export->General->File System.
Then choose "Create directory structure for files" and that should work. I am using Luna.
If you hit problems, let me know.
So my problem is that I want to export my libgdx desktop project as a runnable .jar file. I already made this work and it is working fine when I open the .jar file from my desktop. However, if I put the .jar file into my Dropbox or in any other directory other than my Desktop, it won't work anymore. The Gameframe opens for like 0.2sec, stays black and closes again immediatly. If I then pull the .jar back to my Desktop it works fine.
I've seen other people ask this before, but none of the answers helped me with my problem.
If you need any more info please let me know!
Try opening the exported JAR in (for example) 7-zip and then adding the 'res' folder manualy. I don't really understand, why Eclipse didn't put the 'res' folder in it. But adding it manualy worked for me.
In eclipse, make sure to right-click the whole project and click export. In library handling, click on "Package required libraries into generated JAR". Then click finish. If that does not work, make sure your build path includes everything.
Can I have access to the .jar file so I can look what is missing inside it?
Most likely you got some additional libraries in your output directory which are missing when you place your jar in dropbox. To confirm this try to start your application via command line. Java will then print a stacktrace with the exception. Example:
java -jar yourjarinthisdirectory.jar
As a side note I would recommend to use maven in the future maven libgdx. In this case you just can say "package" and maven produces complete jar with all libs inside it without further configuration.
I'm currently writing a program dependent on LWJGL. Adding the library to my project was easy enough, but I'm having trouble exporting my project as a standalone JAR that the user can simply double-click for a finished product.
WHAT I HAVE TRIED:
File -> Project Structure... -> Modules -> Dependencies tab -> Add -> Jars or directories -> (insert path to natives here) -> Option "classes" in the dialog. -> Check the box under "Export"
DESIRED RESULT: A runnable JAR with no dependency on the command line to open properly. Other JARs and directories being included with my project are fine, but I'd like IntelliJ to export them WITH my project automatically if possible, so that I don't have to manually drag the needed files into the output directory and make a script to run the JAR with the correct natives.
I'm very new to IntelliJ, coming from Eclipse (although I never had to do this in Eclipse, either), and am still coming to grips with the new (to me) terminology used by the program. I'm sure there is a very easy solution I am just overlooking. Thank you in advance.
I was able to get around the issue by using JarSplice to make a Windows EXE that includes the natives within.
I also use IntelliJ, and I've had a similar issue. If you put your natives into a folder somewhere near you, use something like the following at the start of your public static void main method:
System.setProperty("org.lwjgl.librarypath", PATH_TO_LIBS);
Note that you may have to prepend System.getProperty("user.dir") to the front of PATH_TO_LIBS, I'm not certain.
ADDENDUM: You said you'd like any additional files to automatically be created with your jar? Check out IntelliJ's Artifacts. Go to project settings, select artifacts, and add one with the plus button. Once you get an artifact added you can mess around with the file structure on the side, adding in other folders (such as the natives folder, or a resources folders). Once you're done there, you can click Build>Artifacts and it automatically packages them for you, and puts them in a directory (which you can specify on the Artifact window).
I don't know what IntelliJ is so I'm not sure how helpful this will be, but I did do something like this with LWJGL a couple of years ago.
LWJGL depends on native libraries, and the operating system depends on loading those from real native files. You can't load them from inside a jar. So, you can put them in the jar, but you'll have to write some code (which runs before you try to call any LWJGL stuff) which will extract the needed native(s) from the jar at run time and save them in the system temporary directory (or wherever) then load them with System.load.
Then you have to remove/comment out the normal library loading code from org.lwjgl.Sys (the functions doLoadLibrary and loadLibrary). That should do it.
Edit: A similar question is here: How to make a JAR file that includes DLL files?
I am a Beginner in Java GUI and am using Netbeans 7.3 to use Swing Components, the problem is that all was working fine, but one day when I Clicked Clean & Build and tested the JAR file, it was not executing, I ran it in the Netbeans and It is working fine.
Then I thought that it would be a problem of Build Properties so I compared build properties from a project which was working fine with Jar file but I cannot find any difference, The problem is that when I double-click the JAR file, no Error is shown, I tried many ways like executing it from cmd but It did'nt worked.
Can anyone help me out What could be missing, and one thing more that is I even tried to build my project on another computer through Netbeans but no use.
Try to open your .jar with winrar, and check if the classes are being added to the .jar, If they are not being added probably is a bug from netbeans, I would advise to install netbeans 7.2, and then open your project again, and then regenerate the Jar File. I was having a similar problem with Netbeans 7.3
I think you executing .jar file from different folder - not from where it was created? If so - that means your application can not find some files - pictures, etc. So if you have some files which application uses - create the folder named "lib" and place there your files - but not .jar file. For example:
File file = new File("/images/etc.png");
means that it is placed in lib/images directory. So your .jar file could be run from here:
C:/myTestApplications/myApp.jar
which contains also folder
C:/myTestApplications/lib/images
Try that.
Right now i've written a simple SWT application using eclipse, and I want to pack it into an executable .jar file so I can give it out to friends and such. But I have the following problems:
-Right now i'm reading files by using their filename in the program, and putting them in the root folder of the eclipse project. That works fine for running in eclipse, but when I export to jar they're not in the jar. Is there a way to put them in the jar and access them in the code?
-I also need the SWT .jar dependencies or whatever its called(the files you need for SWT).
Does anyone know how to do this?
Take a look at ClassLoader.getResourceAsStream() API.
All you need to do is include these files in the with the source code of your project, then to have access to then have a look at this link