I'm at my wits end. I can't create a jar file (manually or through Eclipse). I've followed instructions for creating the manifest and jar file manually. The end result is that I get an error saying "The JavaJAR file 'widgetSamples.jar' could not be launched. Please check the console for possible errors." The console doesn't register anything when I launch the jar file or when the error message pops.
In eclipse when I create the jar I do get warnings:
Exported with compile warnings: SWT Resources/src/widgetSamples.java
I created a separate simple program to see if it might have been something with my code but I can't even get a simple SWT display to open; I get the same error. The code executes properly in Eclipse.
I have the 64 bit SWT installed as far as I know. Any help is much appreciated. Thanks.
Creating jar file using eclipse IDE
http://www.tutorialspoint.com/eclipse/eclipse_create_jar_files.htm
Creating jar using CMD
http://www.wikihow.com/Create-JAR-File
Related
Running in intelij
When i try to run the .jar
Edit environment variable path
I've written my first small program in java, and want to make it into an executeable file.
I used InteliJ to generate a .Jar file out of the Main class. When i Run the Jar in Intelij it seems to work fine. However once i try to open it from my windows i get
error a jni error has occurred please check your installation and try again
Some googling told me that my JDK might not be properly set in my system properties, so i added the path to my JDK, however the error remains. Anyone have any idea what's up with this? I believe that I added my JDK through inteliJ. Why is it so difficult to simply run the program i made? Is there something wrong with my JDK? is my .jar corrupt?
I am currently having a problem running a jar file created by eclipse.
Within eclipse I can run my project using the run function and the project runs exactly as expected.
The same applies to compiling and running the code from command line using javac Menu.java to compile and java Menu to run.
Both of these run correctly and do not return the error I receive when running the jar file.
The jar file was created in eclipse by exporting the project. But when i run the jar file the application refuses to response when opening any JFrames containing Java3d. Upon debugging the jar file i receive the error
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: javax/media/j3d/Canvas3D
This normally would lead me to believe that my CLASSPATH is incorrect but since the project runs from command line this doesn't seem likely.
Any help or pointers would be very helpful.
Thanks.
Found a solution which works.
Instead of simply creating a jar file, you can created a runnable Jar file.
When asked under library handling in the export process, selecting 'package required libraries into generated JAR' solves this issue and allows it to run on all computers, even ones without Java3D installed.
I wrote an application which starts by reading a configuration (.ini) file and accordingly parses some xml files within a particular folder.
Everything works perfectly when I build and run my application in NetBeans. Now I wanted to run my application through command line (because that's actual requirement of my project), so I am executing the .jar file created by Netbeans to run my application.
I am executing the application as such: java -jar Application.jar.
The issue is when I run this command on command line, the application seems to not be able to find the configuration file which is in the root folder of the project. Its really odd because NetBeans runs it perfectly.
I believe the reason I am getting this exception is because to run the .jar file I am changing my directory to dist and then running the java -jar command and therefore the file is not being found . But then how do I get around this.
Any help is appreciated. Thank you
Sorry got it figured out. I am executing jar file from the root but adding the source in the command as well.
Sorry, you can close this thread.
I had this problem till I installed JRE and did NOT use stand alone.
I recently released an application in the form of a .jar file (built using Eclipse's "Export Runnable Jar File", using Java JRE 6). Most users are able to double click the file and have it run properly, but a few have reported that double clicking the file causes javaw to start, and immediately exit (with no error message).
I have talked with a few users, and walked them through the process of running the .jar from the command line. The users with the issue seem to be getting "Main class not found" errors, even though the .jar has a META-INF folder with a properly formatted MANIFEST.MF file inside.
Is there anything I can do to insure the program will run properly? Is the issue more likely in my program, or in their Java environment?
Thank you.
JAR is non-executable file format and its extension might be not associated with Java. Its better use open source tools like Launch4j or JSmooth to wrap your JAR as an executable file. This way makes your application more user friendly.
Previously, I have no problem in running the JAR file generated by NetBeans.
However, I encountered the problem now all of a sudden. When I click on the jar, it did not launch the application as if nothing is clocked.
But, it can be run from the project. And also, the size of the Jframe for desktop Java application cannot be set from the NetBeans code also. When it runs, the size of the window different from in the designer.
Any help please.
Check your META-INF/MANIFEST.MF file. It should contain a Main-Class: attribute pointing to the class to run initially.
Failing that, what happens if you run it from the console e.g.
java -jar yourjarname.jar
That should give you a much better indication of what's going on.
try to check your JAVA_HOME environment variable, and try to right click on the jar and do open with and check what application is used to open it.
Associate jar files with java instead of javaw. Relaunch. See the error message.