I can't find a working solution for my jar executable. The program runs perfect in my Eclipse IDE, but when I attempt to follow Eclipse instructions, the executable does not work with external JAR.
The JXL jar is in my build path. Anyone know how to get this working through Eclipse? I do not have access to command line.
1.) Right-click on project, select pop-up menu entry "Export...".
2.) Select "Java -> Runnable JAR file".
3.) Choose a working launch configuration for running your program via java -jar MyExecutable.jar from the command line later. Select an output folder and file name. Select "Package required libraries into generated JAR".
Related
I have done rfid reader program in netbeans ide, works fine. then,I created executable jar file by following the steps.
In the netbeans main window,
(i)select the properties under the project folder under properties > build >packaging then enter OK.
(ii)Select Run tab in main window then clean and build Main project.
After these steps, the executable jar file is created in documents> netbeansprojects>project name folder>dist.
I run the jar file from command prompt by
java -jar C:\Users\Holoteq-PC01\Desktop\RFID1\RFIDreader.jar
then i got the error as
Error: could not open C:\Program Files(x86)\Java\jre1.8.0_161\lib\i386\jvm.cfg
why the error comes like that?
i checked java location by where java then the response is
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Windows\System32\java.exe
C:\Program Files\Java\jdk1.8.0_77\bin\java.exe
I read multiple questions pertaining to this issue,i tried almost but the error persists. Can anyone help me to resolve this issue.
I am using eclipse IDE and have been trying to deploy the application with Ant from inside Eclipse as an .EXE file. Inno Setup 5.0 is installed and in my environment path.
C:\Program Files\Inno Setup 5;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_45\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Dell\DW WLAN Card
This is the Error I have from the build
Project\build\build\classes\META-INF
Using base JDK at: C:\Program Files\Java\jdk1.8.0_40\jre
Bundler EXE Installer skipped because of a configuration problem: Main application jar is missing.
Advice to fix: Make sure to use fx:jar task to create main application jar.
BUILD SUCCESSFUL
My question is how do I include the jar and do I have the path coorect for Inno Setup 5.0
#Phantomazi
nice edit
#James Duh
Here are the step by step instructions to build an EXE file with Eclipse Luna for a JavaFX Project
Right Click Project Name in Eclipse
Select Build Path
Configure Build Path
Click Libraries Tab
Click Add JAR
Select your project then navigate to build -> dist -> libs
You should have a ProjectName.jar file in the libs folder
If not create a jar file by opening build.fxfuild
Set Package Format to NONE
Click Generate ant build.xml and run
then set Package Format back to EXE
You Console View will tell you where the EXE file was saved
Example
C:\Users\User Name\workspace\Project Name\build\deploy\bundles
I have created a jar file in eclipse and now I want to execute the jar file in command prompt.
How can I do that?
When your creating jar file using eclipse
While reaching JAR manifest specification
enter main class
Run this command from command prompt:
java -jar <JarName>.jar
Note: you will need to jar a file called META-INF/MANIFEST.MF in order to run the jar after compilation.
If you are creating the jar using Eclipse do this:
Go to file > Export > Java > Jar file (hit next)
Select your project and all the files you would like to jar
Type below the destination of the jar (e.g. c:\MyJar.jar) (hit next x2)
On the bottom Main class either hit browse and choose the class which contains main or type: package_name.class_name (wihch contains the main entry point)
Hit Finish
Go to the jar location in command prompt and run as i mentioned above
in this link http://mina.apache.org/mina-project/userguide/ch1-getting-started/first-steps.html says "Put the following jars in the classpath"
what does that mean? how can I do that in eclipse? without eclipse?
Here's how you could do it in eclipse:
Right click on your project
Select Build path -> Configure Build Path
Select libraries tab
Click on add external jar and select the jar file by browsing your file system and click on open.
click on ok on your configure build path screen.
Without eclipse, when you are about to compile, you will need to use:
javac -classpath <all jar files class path seperated by ; in windows or : on linux> java source file
And similar option while running the class via java command.
Well I have my source code that i have done using the IDE netbeans. Now I wanted to move this java application to a web application. For that I need to create a jar file from my source code, so that I could invoke it in ma jsp file.
I have not been able to find any option in netbeans or any other way to create a .jar file of this source code.
Could someone tell me how to do that.
Thanks
Create a Java archive (.jar) file using NetBeans as follows:
Right-click on the Project name
Select Properties
Click Packaging
Check Build JAR after Compiling
Check Compress JAR File
Click OK to accept changes
Right-click on a Project name
Select Build or Clean and Build
Clean and Build will first delete build artifacts (such as .class files), whereas Build will retain any existing .class files, creating new versions necessary. To elucidate, imagine a project with two classes, A and B.
When built the first time, the IDE creates A.class and B.class. Now you delete B.java but don't clear out B.class. Executing Build should leave B.class in the build directory, and bundle it into the JAR. Selecting Clean and Build will delete B.class. Since B.java was deleted, no longer will B.class be bundled.
The JAR file is built. To view it inside NetBeans:
Click the Files tab
Expand Project name >> dist
Ensure files aren't being excluded when building the JAR file.
Please do right click on the project and go to properties.
Then go to Build and Packaging.
You can see the JAR file location that is produced by defualt setting of netbean in the dist directory.
I also tried to make an executable jar file that I could run with the following command:
java -jar <jarfile>
After some searching I found the following link:
Packaging and Deploying Desktop Java Applications
I set the project's main class:
Right-click the project's node and choose Properties
Select the Run panel and enter the main class in the Main Class field
Click OK to close the Project Properties dialog box
Clean and build project
Then in the fodler dist the newly created jar should be executable with the command I mentioned above.
Now (2020) NetBeans 11 does it automatically with the "Build" command (right click on the project's name and choose "Build")