I am creating a SWT/JFace project and exporting as executable jar. But this jar is not working on the other computers. When use double clicks the jar nothing happens. I am sure that other user has JRE installed.
I think problem is the Referanced Libraries. Beause near the libraries its written
C:\Users\Turgut - İhracat.p2\pool\plugins\org.eclipse.osgi_3.12.50.v20170928-1321.jar
Here is the Screen capture of libraries. Any helps will be apriciated..
Remove all referenced jars,
Create a 'lib' folder in your project,
Paste your referenced jars into
'lib' folder;
Add these jars into 'classpath'
If this not work, execute your jar via command line to see the error.
Related
I'm trying to find more information on how eclipse handles Running a project.
I want to understand it more because I have an issue I'm currently having where apache-poi .jar files which have been included into the classpath of my project will work properly when the project is ran through eclipse, but will not be detected when going to the same projects folder and running the main jar file to start the program.
It gives me the error: java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell (although sometimes instead of Cell, it's Sheet)
What could I consult to understand what is going on here, and possibly solve this issue?
Your NoClassDefFoundError indicates that the library was not available while running the jar.
This depends upon how you are exporting your project into the jar file.
If you're using eclipse to do so, you can:
Export->Java->Runnable Jar to create a jar that includes its dependencies
Make sure to check Package required libraries into generated JAR.
This will make all your jars (in build path including apache-poi.jar) as a part of the final jar.
It runs from eclipse because libraries are on the build path of the eclipse which makes them available in the classpath.
I'm developing a RestFul services and I have my jar client that contains all my DTOs to communicate with the android application(client side). I can have reference to my jar client in the eclipse editor, but when I generate the APK and run the application in my emulator or my cellphone the class doesn't exist because the jar wasn't imported to the APK.
I test many things, adding the jars into the library and export them, also, I created a User Library and included all my jars into this and export that library, but neither of these work.
Anybody can help me please?
First of all, create a folder called "lib" inside your eclipse project and put all your jar files in that folder.
Then. go to:
Project->Properties->Java Build Path->Libraries
Just click into "Add JARs..." and select the jar files inside the lib folder.
Click and OK and Clean/Build your project
You will probably need to export the JAR file you are referencing if it hasn't already been added to the "Android Private Libraries" group in Eclipse.
Suddenly, all my code depending on external jars doesn't work.
For example:
Jsoup.parse(str)
gives:
could not resolve type: org.jsoup.Jsoup
And i'm 100% sure that it is in the build path.
Maybe it happenned because I updated the ADT plugin and the platform tools to the latest version, but it doesn't make sense...
But it started occuring since I updated those.
So apparently eclipse doesn't compile those jars. (In code, it DOES resolve the jars types)...
Do you maybe know what is the problem?
This has nothing to do with compilation: jar's are already compiled.
You only need to add the jar to your project classpath so Eclipse will know to run java with the .jar. You can do this with "Context/Right click menu->Properties > Java Build Path > Libraries" (source). For portability I recommend placing the .jar in a subdirectory of your project. A "lib" folder in your project root (where "bin" and "src" are too) is commonly used.
Also note that to run your program you will need to add the dependency .jar to your java command, but with a little searching you can find out how to include the dependency .jar in your own combined .jar.
You have to put the libraries in /libs folder of your project (if you are using Eclipse you choose "Add JARs.." not "Add external JARs..")
New to NetBeans dev here. When I first created my project and began compiling, I noticed that NetBeans had automatically created a dist/ directory under my project root and was creating an Executable JAR in that directory.
I've now been developing for several weeks, and added many resource files to my project, including a system log file, an embedded SQLite database, and several properties files. These are files that my program (a Swing app) needs to read/write from at runtime in order to function correctly.
I just noticed this morning that the Executable JAR in my dist/ directory is several weeks old, and that compiling my project doesn't update it. I am wondering if that's because there are now all these new resource files and NetBeans doesn't know how/where to package them for the automatically-created Executable JAR.
Does this mean that I'll have to tweak the build.xml myself? Or is there a NetBeans dialog I can get to where I can specify where to pacakge everything? And if NetBeans should be doing this automatically, what could be the reason that it stopped creating the JAR for me, and what can I do to force this functionality again?
I went into Project Properties >> Packaging and made sure that the JAR file directory was still dist/MyProgram.jar and that the checkbox Build JAR after compiling was still checked, so obviously something else is either breaking the build or messing with NB.
Thanks for any tips!
If "Compile on Save" is enabled, then your .jar file will only be generated when you do a "Clean & Build" (Just "Build" is not available when "Compile on Save" is enabled)
You need to Clean and Build within netbeans to update the file within your /dist directory.
I use Netbeans 7.0 and this solution works for me.
I have a Java project that utilizes Jython to interface with a Python module. With my configuration, the program runs fine, however, when I export the project to a JAR file, I get the following error:
Jar export finished with problems. See details for additional information.
Fat Jar Export: Could not find class-path entry for 'C:Projects/this_project/src/com/company/python/'
When browsing through the generated JAR file with an archive manager, the python module is in fact inside of the JAR, but when I check the manifest, only "." is in the classpath. I can overlook this issue by manually dropping the module into the JAR file after creation, but since the main point of this project is automation, I'd rather be able to configure Eclipse to generate properly configured JAR automatically. Any ideas?
*NOTE*I obviously cannot run the program successfully when I do this, but removing the Python source folder from the classpath in "Run Configurations..." makes the error go away.
Figured it out, had to add the source folder with the Python module in it as a class folder in the Build Path project properties. Not sure if this next part is necessary or not, but since the module is not compiled, I added the folder again as "Attached Source" after adding the class folder.
Have a look at the maven-jython-compile-plugin and its demo project at http://mavenjython.sourceforge.net/ . It allows bundling jython with dependencies into a standalone jar.