Eclipse Java project to runnable EXE - eclipse

I've been looking around for an answer for almost a week now, but I cannot seem to find the correct one. So I've built a GUI java application on Eclipse. I have Java JDK version 1.8.0-45 and referenced around 4 libraries to my application. I want to be able to create either a .jar file or a .exe file(s) that will run on any other computer.
So I've gotten a couple of solutions. I've tried JSmooth, Advanced Installed 12.2, Launch4J and every single application works. I double click on the generated files, and it runs perfectly on my computer. Even just exporting a runnable jar file from eclipse runs perfect on mine. But here's where I'm running into issues. If I take the generated jar/exe file to another computer, it doesn't work.
I thought that other computers didn't have a valid JRE, so I downloaded and installed Java JRE 1.8, and it doesn't work.
I"ve used Launch4J and even made sure to bundle the JRE with the jar, but it doesnt work.
I imported the entire eclipse project to Advanced Installer, made a .MSI installer including the jar and the JRE but it doesn't work.
I've used JSmooth, to generate the exe, and it doesnt work.
Reiterating, everything works on my computer. But what doesnt work is when I take the generated exe file to another computer and double click on the files, nothing happens. I don't see any GUI window or any JFrames. Absolutely nothing happens.
So if anyone could point me to a direction, or tell me what I'm not doing or what I'm doing wrong, it would be really appreciated. I've done my research for quite a bit, but I'm getting nowhere. HELP!

I figured it out. Apparently I was running into a version mismatch issue. Compiled with JDK 1.6 and it worked flawlessly!

Related

JavaFX program to JAR, been trying to do this for days

Can anyone help me convert this javaFX application into an actual application using JAR, becuase ive been trying to convert it to a JAR for days and it just comes up with error after error. I just want to make an exe but i know how to do that, the JAR ive been trying to make and it makes it, but it never runs, just errors, a million of them.
Here's my github repo https://github.com/Amarnath-someperson/JavaFX-Physics-App with the code in JavaFX-Physics-App/PhysicsApp/src/main/java/com/example/physicsapp/
Creating jars for JavaFX apps is not well supported and you just should not do it. Instead look here https://stackoverflow.com/tags/javafx/info in the Packaging section and create a real app bundle and installer.
I recommend taking a look at this Github repo: https://github.com/wiverson/maven-jpackage-template
It contains a working projekt using Maven, JavaFX 17 and Java 17. Running maven install creates an installer and a runnable exe file. As soon as you get it running, making the necessary changes for your project should not be too difficult.
Asking others to do the complete work for you probably is a bit too much in my opinion. You will need to get a basic understanding of how the packaging works to maintain your project anyway, so I hope this is enough to get you started.
Packaging your application as jar is only useful up to Java(FX) 8, since JavaFX is not included in most JREs after that. So, while it is easy to create the jar, non-developers won't be able to run it.

Compile and run a netbeans project with terminal

So I created a project in netbeans and then added a new JFrame form (this is my first gui app). I was wondering if there was any way to open the source code in another app like textedit and compile it using terminal (javac blah.java, java blah).
I managed to create a .jar file (clean and build) and it works perfectly fine when I try to run it (double click). Now I managed to find the .java file in src but when I compile it I receive 36 errors, which makes no sense since it built and ran perfectly fine and the jar file works.
Essentially I want to just take the source code (not the entire project) and compile it, for example on a computer that does not have netbeans using terminal. Can this be done?
I would also like to emphasize that I'm just a beginner. Thanks!
Standard NetBeans projects are based on Apache Ant. So it should be sufficient to install Ant and a JDK to compile/package your project on another computer or CI system.
What i found to be the culprit to this problem is that on your source code make sure it does not have package. So for example:
"package blablah"
All you have to do is get rid of that, and then take your java file and it should compile perfectly. For some reason that causes the nodefclass error.

How do I get Junit 4.10 to run from the command line on Windows without typing the path to every file?

I guess this is easy for everyone else but I cannot get junit to work from the command line. I had no problem installing the java run time environment, but this junit install has more to it that I'm apparently not seeing.
My class path is:
.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip.;set classpath=%classpath%;C:Program Files\JUnit\junit-4.6.jar;C:\Program Files\JUnit\
My windows path is:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\wbem;C:\Program Files\Common Files\Teleca Shared;C:\Program Files\Java\jdk1.6.0_30\bin;C:\Program Files\JUnit\junit-4.10.jar;C:\Program Files\QuickTime\QTSystem\
Someone please tell me what I'm doing wrong. I can't get junit to run its test files or any file that I've written.
You should not be putting stuff in the JRE lib/ext directory. Learn how to use CLASSPATH properly.
If that CLASSPATH is an environment variable, you're learning something important: You don't need it. The JVM, IDEs, and app servers all ignore it.
The right way is to use the -classpath option on javac.exe and java.exe when you compile and run.
You shouldn't be altering the PATH for every Java project, either. Point it to the JDK/bin so you can access the tools you need, but that's all you should have to do.

Found unsigned entry in resource ... .jar

I'm using Netbeans to compile and sign all my jars, all with the same certificate. However, when I run Webstart with Sun Java SE 6, I get the error Found unsigned entry in resource .. .jar.
I messed around with adding and removing jars, etc, but no luck.
As far as I know the keystore is in the build directory and gets created on every clean and build.
It gives this error not for one jar, but multiple (switching orders of jars led me to believe this).
I'm using Netbeans 7. I booted Windows this morning and got the error, which I didn't have yesterdag or before.
I'm pulling my hair out, Webstart and the like is driving me crazy! Any help would be really appreciated.
Edit: The manifest files all look alright btw.
Edit: The jnlp looks fine as well, and didnt change any from before it broke.
Enabling JAR caching should fix the problem. It's a common bug that exists in Java for years. For details, see my blogpost:
https://www.nowaker.net/post/found-unsigned-entry-in-resource-java-web-start.html
I restarted the pc again and it works again. Must've been something weird with the Java JRE or something...

Eclipse RCP- org.eclipse.ui.plugin missing

I've written an Eclipse RCP application that runs fine in Eclipse, however, packaging it to be a standalone application has been tricky. I've worked my way though a few class path errors, but now I'm getting a new one.
After running the export wizard and launching my application, it throws a ClassDefError and ClassNotFoundException, specifically it's looking for org.eclipse.ui.plugin.AbstractUIPlugin. I did not find this in my copy of the eclipse SDK, and I downloaded the SDK again to be sure, and still couldn't find it. I found a jar online that supposedly contained the fiel along with some other eclipse packages, however, I then got this:
NoSuchMethodError: org.eclipse.ui.plugin.AbstractUIPlugin: method ()V not found
I figure the problem is more I did something wrong rather than this class is actually missing, but I've gone though all the configurations and I'm sure all the required packages and dependencies are included. Any ideas?
Download and install the new version of adt plugin 21.0.0.
Does your application works when you run from Eclipse? If so then try to open your plugin.xml, go to Runtime and on the bottom right part of the window you should see Classpath. Try adding the required plugins there.