I have no idea why, but when i export my java program into a Jar it just wont run. There are no errors when building or running it. When I run the program through eclipse it work perfectly.
Anyone had this problem before or care to take a look?
regards,
Matt
As Shark said, it has to be exported as an Executable JAR file. Just exporting your project to a JAR is insufficient.
Here's a nice write-up on making Executable JAR files:
http://www.mkyong.com/java/how-to-make-an-executable-jar-file/
If you want to make it from Eclipse, Export as Java | Runnable JAR.
windows 8 installed java 1.6 without the correct paths. I installed jdk 1.8 and it worked.
Related
I am trying to create an .exe file from a -jar file the problem is i am using javafx-sdk-15.0.1 and jdk-15.0.1. For some reason when i use launch4j it wont open the newly created .exe. Can someone help me please. How do i incorporate these two things (javafx-sdk-15.0.1 and jdk-15.0.1) in the .exe.
Note: To run jar from CMD i use this-
java -jar --module-path C:\Users\PC\Desktop\javafx-sdk-15.0.1\lib --add-modules javafx.controls,javafx.fxml "C:\Users\PC\Desktop\Taco\Good Taco Shop.jar
I also put the JDK/bin in my path.
Thank You!!
Have a look at the relevant tools that come with your JDK. These are jpackage, jdeps and jlink. Here is a tutorial on how to use them: https://github.com/dlemmermann/JPackageScriptFX
I want to run edumips.jar. Whenever I try to open, Java control panel is opened.
When I execute:
strong text
It is first time to download java and excecute .jar file.
What I want:
Please tell me what I'm doing wrong...
UPDATE: there is now an MSI installer for EduMIPS64 which allows you to install and run the simulator without worrying about installing a JRE and configuring it: https://github.com/EduMIPS64/edumips64/releases/download/v1.2.8/EduMIPS64-1.2.8.msi (version 1.2.8 was released at the time of updating this answer, there might be more recent ones).
You need to make sure the Java runtime is associated with the .jar extension to open it with double-click.
To open it once, try right-clicking on the JAR file select Open With... and find the Java runtime binary (it's "OpenJDK Platform Binary" on my Windows machine).
You may also be able to fix this by re-installing the Java Runtime (JRE): usually installers associate .jar files to the Java binary automatically.
Worst case, if Java is installed and the PATH is set up correctly, you can run it from the command line by using the command java -jar edumips64-1.2.6-standalone.jar.
To open the command line, press Win+x and choose Windows PowerShell. Your JAR might be in the Downloads directory so try java -jar Downloads\edumips64-1.2.6-standalone.jar.
I am running XUbuntu x64 14.04.4 LTS on my PC, with eclipse Mars.2 Release (4.5.2) and JDK 8 properly linked up to my eclipse (via ini file).
So basically, I "upgradet" to e(fx)clipse. Then I crated a new "JavaFX project". When I tried to run it, I got the error The import javafx.application cannot be resolved.
A quick google search brought up, that I need to add the jfxwt.jar from my java 1.8 directory (in my case /opt/Oracle_Java/jdk1.8.0_91/jre/lib/).
But the error didn't went away. I also tried the build options but nothing seemed to change anything.
First of all, I included the wrong jar. whoops. thanks to #DVarga for the tip.
But that wasn't the problem. So here are all the steps I took, to create a working e(fx)clipse environment:
Download the latest eclipse version and add the e(fx)clipse package.
Update to the latest JDK and reference that in the eclipse.ini file (1)
Tell ecplipse the path for the latest JDK. Although this tutorial is for MACs, it works pretty much the same in linux. There are a few differences tho:
The preferences menu is in window > preferences
The JRE type is not MacOS X VM but rather Standard VM
The JRE home path is the jdk1.8.0_VERSION folder (in my case /opt/Oracle_Java/jdk1.8.0_91)
I didn't need to add any other jar for javaFX to work properly.
(1) How to add the Java 1.8 path to eclipse
if you get the error "JavaFX was disabled because your java version is to old" (or something like this) you need to update to at least Java 1.8 and edit the eclipse.ini file in the eclipse folder.
There you have to look for the line -vm. In the next line is a path to an old Java version. Change that to the new path. It should look like this: /path/to/jdk1.8.0_VERSION/jre/bin/ in my case it is /opt/Oracle_Java/jdk1.8.0_91/jre/bin/
I am trying to compile the SpeechMe project: http://projects.developer.nokia.com/speechme/wiki so that I can use the voice recognition in another project I want to make.
I have followed all the instructions and downloaded the full sources of Sphinxbase and Pocketsphinx and used them to add all the missing files to the Sphinxbase and Pocketsphinx directories included in SpeechMe. I have compiled them all in the order the wiki says and they all returned: "***Build Complete" but it seems that they did not produce any output files?
I then tried compiling SpeechMe in Qt Creator but it gives me these three errors:
Here is the build log for all configurations: http://sdrv.ms/PxlD6r
Please help, I really don't understand why this is not working!
I'm guessing Carbide should have created those 3 files when compiling but it didn't, any ideas why and what I can do to fix it?
Files must be created inside pocketsphinx tree but they shouldn't be placed in the required location. Most likely you need to find library files and put them into the required folder manually.
Another reason might be that you are compiled a debug version of pocketsphinx while the latest project is looking for a release version of the libraries.
i want to know how to make a jar app which will run on java mobile platform using class file of java.
i know basics of java like inheritance,interface,string.....I tried this thing by compiling my java program of simple input/output and then converting it to jar using -jar in cmd.but i dont know why it is not working on mobile showing invalid file.
plz help me.
If you want to create a jar application, starting from a java class,you don't have to use java -jar filename.jar, this is only for execution.
Try this: jar cf your_jar_app.jar your_class_file.class
c option is needed to create file and f option is needed because you want an output file.
Then you can execute typing: java -jar your_jar_app.jar
Hope this can help you.
For documentation: Oracle Documentation for creating JAR file
If you are using NetBeans IDE, take a look to: NetBeans Packaging and Deploying Java Applications