vicky99
May 28 2006, 11:56 AM
Dear Friends Today I will show you how to create an executable jar file. I do not know whether this topic is introduced by any other member. Using this method one can build graphical user interface program with java which will behave similar to Executable files i.e., the program can be started with double clicks. It is an easy alternative. Otherwise to run a java program one has to run it through comand prompt(in windows) using java command or by creating java executalbes which are very difficult to make. So lets begin: Frist of all, we will create a simple java application using java foundation class popularly known as java Swing. Let the file name be JarExample. CODE import java.awt.*; import java.awt.event.*; import javax.swing.*;
public class JarExample { private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Window"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel emptyLabel = new JLabel(""); emptyLabel.setPreferredSize(new Dimension(175, 100)); frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
frame.pack(); frame.setVisible(true); }
public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }
Now compile the java file. JDK will produce two class files namely (a)JarExample.class (  JarExample$1.class. All the years we have been doing this.Your question might be what new? Its coming. Now we will create a Manifest File. If you have done java beans then you are quite familiar with the term. Let write our Manifest File:- The name of the file is :- jex.mf CODE Manifest-Version: 1.0 Main-Class: JarExample
We are now ready to create our JAR file. create a folder, keep the class files (JarExample.class,JarExample$1.class) and the manifest file in that folder. Now open command prompt. Say for example your folder name is jar and you have kept it in C DRIVE. Now change directory using CD jar command. Now we will create jar file using following command. c:\jar>jar cfm jarex.jar jex.mf *.class It will create jarex.jar . I wish you will be able to create jar file using this method. If any problem occur feel free to ask me or you have any suggestion please tell me.
Reply
iGuest
Oct 10 2007, 04:33 AM
Query : How can I set/change an Icon for my exe jar? -Tanveer I. Shaikh
Reply
java-area
Feb 4 2008, 03:57 AM
vicky99, cool! The key point of creating executable JAR-file is creating manifest file, which has a link to the executable class (the class with a static public method Main).
Reply
iGuest
Mar 17 2008, 08:26 AM
Creating executable jar file in java
Creating Executable Jar Files
I created the jar file as per your instruction, but it is not executing by showing the error " FAILED TO LOAD MAIN-CLASS" MANIFEST ATTRIBUTE FROM THE RESPECTIVE JAR FILE (Eg. My jar file name is test so it is showing c:\test.Jar). What might be the problem . Please help me out in this regard Pradeep -reply by pratheep kumar s
Reply
java-area
Mar 25 2008, 03:35 PM
QUOTE(FeedBacker @ Mar 17 2008, 04:26 AM)  Creating executable jar file in java
Creating Executable Jar Files I created the jar file as per your instruction, but it is not executing by showing the error " FAILED TO LOAD MAIN-CLASS" MANIFEST ATTRIBUTE FROM THE RESPECTIVE JAR FILE (Eg. My jar file name is test so it is showing c:test.Jar). What might be the problem . Please help me out in this regard
Pradeep
-reply by pratheep kumar s It works well! But there is a small truck. Lets look at Sun's tutorial: "Note : The contents of the manifest must be encoded in UTF8"( http://java.sun.com/docs/books/tutorial/de...jar/modman.html) I tryed to create the manifest file (in our case - jex.mf) using different text editors and I had different results!!! When jar utility program understand the context of jex.mf, it includes the string "Main-Class: JarExample" into the new manifest file, which can be found in executable jar file. But sometimes Jar utility does not understand the text format of manifest file (jex.mf) - seems, it depends on the text editor, used for creating jex.mf. For example, I have created a new text file in Wordpad, copied the string "Main-Class: JarExample" into it and saved as jex.mf. Jar utility has successfully created executable .jar with manifest file, containing "Main-Class: JarExample" But I am not pretty sure about other text editors and formats, used for creating jex.mf. So, you need to double check manifest file in executable .jar - If it does NOT contain the string "Main-Class: JarExample", put it manually.
Reply
iGuest
Mar 31 2008, 05:49 AM
creating jar files with external jar files
Creating Executable Jar Files
Replying to java-areaReplying to java-areaHi, I want create a jar file that contain other external jar files. My Manifest file manifest.Mf looks like: Main-Class: MainClass Class-Path: lib\jar1.Jar lib\jar2.Jar lib jar3.Jar... I used the command >> jar cfm myJar.Jar manifest.Mf * The jar myJar.Jar is working only in the location where I created that jar file.When I tried to move that jar file into another loacation it displaying an exception reagarding the external jar files..If I copy that lib folder having the external jar files into that location it will execute.. Thanks in advance. Rajisp -reply by rajisp
Reply
iGuest
May 29 2008, 12:39 PM
JMF doesn\\
Creating Executable Jar Files
I have a problem with JMF .I m working on capturing of image from webcam. When I build path of JMF lib files by adding �Add Jar � from eclipse IDE , my application run but capture function of webcam doesn�t work means it doesn�t get path of JMF lib file . But if JMF lib file added directly from C:\Program Files\JMF2.1.1e\lib, it captures image. I created executable jar file with the help of One jar file.But my executable jar file doesn�t work with JMF . Can anyone help how to set path of JMF lib file so that it capture image from executable jar file. Thanks a lot in advance -question by Shweta
Reply
niks
Jul 15 2008, 05:56 AM
Hi, I have created the jar file in the way described by you, but i ma not able to execute it by double clicking it. I get the following screen(winrar screen). Kindly help as his is really urgent. And i will be greatful if you can through some light on running this same .jar file on windows mobile.
Thanks and Regards,QUOTE(vicky99 @ May 28 2006, 11:56 AM)  Dear Friends Today I will show you how to create an executable jar file. I do not know whether this topic is introduced by any other member. Using this method one can build graphical user interface program with java which will behave similar to Executable files i.e., the program can be started with double clicks. It is an easy alternative. Otherwise to run a java program one has to run it through comand prompt(in windows) using java command or by creating java executalbes which are very difficult to make. So lets begin: Frist of all, we will create a simple java application using java foundation class popularly known as java Swing. Let the file name be JarExample. CODE import java.awt.*; import java.awt.event.*; import javax.swing.*;
public class JarExample { private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Window"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel emptyLabel = new JLabel(""); emptyLabel.setPreferredSize(new Dimension(175, 100)); frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);
frame.pack(); frame.setVisible(true); }
public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } Now compile the java file. JDK will produce two class files namely (a)JarExample.class (  JarExample$1.class. All the years we have been doing this.Your question might be what new? Its coming. Now we will create a Manifest File. If you have done java beans then you are quite familiar with the term. Let write our Manifest File:- The name of the file is :- jex.mf CODE Manifest-Version: 1.0 Main-Class: JarExample We are now ready to create our JAR file. create a folder, keep the class files (JarExample.class,JarExample$1.class) and the manifest file in that folder. Now open command prompt. Say for example your folder name is jar and you have kept it in C DRIVE. Now change directory using CD jar command. Now we will create jar file using following command. c:\jar>jar cfm jarex.jar jex.mf *.class It will create jarex.jar . I wish you will be able to create jar file using this method. If any problem occur feel free to ask me or you have any suggestion please tell me.
Reply
toby
Jul 15 2008, 01:34 PM
Can I make an executable from a website java archive(.jar)?
Reply
iGuest
Jul 29 2008, 10:26 AM
creating a jar file
Creating Executable Jar Files
When I create ajar file it gives me a Java.Io.IOException: invalid header field at java.Util.Jar.Attributes.Read(Attributes.Java:393) at java.Util.Jar.Manifest.Read(Manifest.Java:167) at java.Util.Jar.Manifest.<init>(Manifest.Java:52) at sun.Tools.Jar.Main.Run(Main.Java:123) at sun.Tools.Jar.Main.Main(Main.Java:90) What does this mean.Please help me out. -question by arti
Reply
Recent Queries:--
how to run webcam with a jar file in java - 8.69 hr back. (1)
-
create jar with images - 9.18 hr back. (1)
-
create jar with gif - 9.93 hr back. (1)
-
"create a jar file" "create the manifest" - 10.69 hr back. (1)
-
how to create an executable jar file - 11.07 hr back. (2)
-
create jar files - 12.71 hr back. (1)
-
how i make a executable jar file for java program - 24.41 hr back. (2)
-
public void main modify file inside jar file - 29.05 hr back. (1)
-
webcam image on jpanel - 32.63 hr back. (1)
-
how to create executable jar with manifest - 34.72 hr back. (1)
-
how to create executable jar - 34.81 hr back. (1)
-
sample class manifest.java - 35.35 hr back. (1)
-
how to set classpath for executable jar in manifest.mf - 36.34 hr back. (1)
-
how we make jar files - 37.98 hr back. (1)
Similar Topics
Keywords : creating, executable, jar, files
- Creating An Mmo
(1)
Playing Two Wav Files Simultaneously In C#
(4) I have reached a dead-end, in trying to code the Audio Engine for the game - Bomber Man . The
current engine uses the native functions(waveOutOpen, waveOutWrite, etc) declared in Winmm.dll file.
While this allows me to play two sounds together (the Background music and the sound effects), it
causes frequent memory corruptions. For instance, it changes the value of an integer variable
located in a different and unrelated class. I spent hours trying to find out why the value was
constantly changing. When I disabled all the sounds, the problem didn't occur. I used a mo....
Creating A Php Login Script
A thorough look at the process behind it (3) Hey all, after reading through a fair number of tutorials on this subject I decided to write a
pretty detailed one myself. Apologies for those who don't like my structured layout, it's
just the way I do things. /wink.gif" style="vertical-align:middle" emoid=";)" border="0"
alt="wink.gif" /> Title: Creating a PHP Login Script Objective: To go through a series of basic
steps required to create a method of user registration, login and permission management using PHP
and MySQL. Notes: The information is designed to work fully on AstaHost's hosting plans. ....
Need Some Help/advice On How To Restore Lost Files
(5) My problem is this. I had a photo loader software installed on my computer. This prog indexed a
couple of hondred photos I had. Yesterday I uninstalled the prog form my computer without
considering the posibility that the folder containing my photos would be deleted to which it did. My
question is this, what if I used system restore? would it restore my photos too? Or would it simply
restore just the prog files only?....
Need Some Help/advice On Lost Files.
(8) My problem is this. I had a photo loader software installed on my computer. This prog indexed a
couple of hondred photos I had. Yesterday I uninstalled the prog form my computer without
considering the posibility that the folder containing my photos would be deleted too, which it did.
My question is this, what if I used system restore? would it restore my photos too? Or would it
simply restore just the prog files only? ThnX in advance....
3d Game Creating Thing
(1) I saw a lot of FPS Game creating software topics in the FPS thread. But what I want is a 3rd person
game making software. What I want to make is something like Prince of Persia or some medieval game.
It must not be first person. I want it to be 3rd person. I couldn't find a good 3rd person game
creator. I did see some softwares in many websites but I don't know whether they are good. I
tried Game Maker Pro 7, but you can only make crappy doom 1 style games from it. I want some thing
with much more flexibility where you can work in an 3d environment and apply sha....
Friends Can't Start The Exe Files I Send :(
(5) I am using visual c++ 2008. and when I send the .exe file that I created to my friend, (from the
debug folder) he gets an error message when trying to execute it /sad.gif"
style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> any ideas? when my friend
tried, he said that he got the following error message: cannot execute .... And lots of PC info.
When I create these files, I choose win32 console application (something that looks like the cmd
when executed) please.. I really need to get this thing working Thanks //Feelay....
Uploading More Than 30 Files In Less Than 10 Clicks?
(5) Hey! is it possible to upload lots of files fast, and to a specefic folder? I am sure you guys
are going to tell me "use" the FTP tool.. But I have no idea how to use it =/....
Creating Interactive Pdf Documents
(2) Is there any freeware I can use to create interactive PDF documents like the one linked to below, or
can it only be done using Adobe Acrobat, the full edition? The effects I need are the translucent
hint box in the upper left hand corner, clicking a number to set a checkmark on top of it, and the
reset button at the end of the first page. http://forms.cgaux.org/archive/a7060f.pdf ....
Best Software For Creating Games
(9) I want to know which software is the best to make world maps and characters for games. Should I use
3ds max or Maya or something else. Please advice....
If You Have Some Private Files
(17) Hello everyone , Here in this post I will show you how to hide your private files and folders If
you have some private files and want to prevent others from seeing them you can follow these steps
to hide these private files First Step Create New Folder any where and rename it hold Alt key
and press 255 Now you will notice the folder has no name Second Step Now right click this folder
and select Properties then Customise then change icon and select invisiable icon for this folder you
will find 4 empty area icons all are fine Third Step Now move all your private ....
Creating Flash Image/slideshow
(2) Hi, is there any simple way to create a Flash (or any animated) movie/slideshow similar to this one
? I want to have a similar effect on one of the myspace accounts I'm helping a user create. I
want to avoid using Adobe Flash if a website or some free program can do this job for me. Thanks.....
Creating New Process Under Alternate Credentials (createprocessasuser)
(6) I am having quite the time spawning a process under a different user context. My preferred method
involves using the Windows API functions LogonUser() and CreateProcessAsUser() but I have not
figured out a way to overcome several error messages. I also have the particular problem of running
my program from the system account which I have found affects the behavior of CreateProcessAsUserW.
Added to this toxic mix are several bugs scattered throughout the Windows API and .NET framework.
After numerous attempts and about two weeks of frustrations I am open to suggestion....
How To Embed Swf Files In Joomla ?
(9) I want to embed some swf game files into my Joomla project, I've been at it for two hours and
haven't made much progress. I've tried making a new content item and placing ... but that
hasn't worked. I'm kind of stuck /sad.gif" style="vertical-align:middle" emoid=":("
border="0" alt="sad.gif" /> Anyone familiar with Joomla or Mambo that may have some knowledge
regarding my issue?....
Get User Input From Vbscript For Batch Files
Get user input from vbscript (2) Hello, I didn't see a tutorial on this subject so i'll go ahead and do it. Long ago I used
batch file programming a quite a bit. I used vbscript files to get user input for the batch files.
So here is a simple example of using the 'call' command to call for the vbscript file which
should be in the same folder as the .bat file. in the batch file pretty much anywhere you can start
the vbscript, and call another .bat file- using @ to of course not echo the line of code - CODE
@ start /w wscript.exe userin.vbs @ call ~anyname.bat @ del ~anyname.bat....
Creating Irc Chat Room...
(10) Hi, I know that IRC is not for newbies, but we all have to start somewhere right? Well, I read and
read...and read even more. But I still have questions on my mind before I dive into the IRC world.
I have used IRC Chat before, but don't call myself a regular user /wink.gif' border='0'
style='vertical-align:middle' alt='wink.gif' /> I was never a OP before so this is a first... If
anyone can answer these questions to get me started, that would be great /smile.gif' border='0'
style='vertical-align:middle' alt='smile.gif' /> I apologize for the bunch of q....
How Can I Delete Old Files In Windows Xp ?
HELP!!! (21) I've just reinstall my system. But I can't delete old profiles in C:\Documents and
Settings . I have the Admin right, of course. But... the system don't allow me to delete
the files. I need to free up some space on my hard disk. (That folder's size is up to 12GB)....
Renaming Files (Using Excel Spreadsheet)
(20) Hi, I want to use filenames on my Excel Spreadsheet for the files I have in my folder. For example,
let's say I have these in a folder: Reportdummy.doc Charts102.xls DecemberGraphs.xls
TestScrap.txt etc... And I have this in my Excel spreadsheet: Report1.doc Charts.xls Graphs.xls
Scrap.txt etc... Is there an easy way for me to copy the cell's value to the file in that
folder? I want them to be copied exactly in that order. So far I have to do this manually (copy
from Excel, then rename and paste for each file). Thanks.....
Switch Network Settings With Batch Files
A quick way to change IP, Gateway, DNS (18) Let's suppose you are using two network settings with your laptop frequently. Wether it's a
wireless or wired network, all the same: Every time you want to change the IP, subnet mask, default
gateway and DNS Server(s) of your network connection in any flavour of Windows, you have to click
through menus, submenus, and from that you go to yet another submenu... you have been there,
it's awful. /mad.gif' border='0' style='vertical-align:middle' alt='mad.gif' /> There is a
better way: the command "netsh" on your command prompt can change all the aforementio....
Help Me: Need To Transfer Files From Old Computer
(18) How to I upload my computer stuff. I bought a new computer - a Dell. But I need to get all my files
form my old computer, and Emachines, can someone help me?....
How Do I Chmod Files On Astahost ?
(20) Hey, how do i CHMOD certain files, i need to CHMOD some files to 0777 but i dont know how :-\ i
use ws_ftp as my ftp client i also have flash fxp....
How To Play *.rm Files With Media Player
(13) How to play Real audio and video files (*.rm) with Windows Media player!? /blink.gif'
border='0' style='vertical-align:middle' alt='blink.gif' /> Because of competition between
Microsoft and Real Networks, Windows Media Player does not support Real audio and video files, and
real networks does not release any patch for WMP. But, Real has released a patch for other media
players. Now, I want learn you, how you can use this patch to play Real audio and video files. You
should have Windows Media Player and Real Player: 1- First go to sourceforge.net website and down....
Sharing Files In Windows Xp Home
I always get an "access denied mesage" (15) when trying to access another computer's shared files on my home network i recieve an error
message " is not accessable. You might not have permission to use this network resource. Contact
the administrator of this server to find out if you have access permissions. Access denied" anyone
know why I am getting this message?....
Creating You Own Game In RPG Maker 2000/2003
Part 2 - Map Designing (12) Map Designing is a very important part in your RPG game. The maps are made up with many different
graphics, which we call Chipsets. You can import your own Chipsets in the Database. Check out the
other tutorial to find out how to. Once you are at the map design, you will have all ocean. If you
look to the left, you'll see graphics you can choose from. You need to put thoses graphics from
the left to make a game on the right. First, we need to set the graphics, or Chipsets. Right-click
on the MAP0001 folder under the graphics box to the left and choose Map Propertie....
How To Transfer Files From One Computer To Another
(16) Hi friends, I have two computers both having windows XP pro operating system and i have
one LAN cable and i connected both computers through LAN terminals and i'm unable to transfer
data from both computers.So what setting i have to make for doing this? Thanks, sunny....
3ds Max Tutorial #2-creating Reflective Materials
(1) The next tutorial is based on creation of a reflective material in 3ds max. this tutorial will help
u create a surface that reflects everything in sight. 1. Fire up 3dsmax. 2. Press 'm' 3.
Change the box where u see 'Normal' i.e. material type. Change it to raytrace. 4. Change the
colours to the colours you want. 5. In the maps section click the box next to reflection. 6. Select
raytrace from the list. 7. Apply the material to any object. 8. Render the scene
Voila!!! you have created a reflective material. You can also try.. 1. Using the ....
Creating A Game In Rpg Maker 2000/2003
Part 1 - New Game and the Database (18) Creating a game in RPG Maker 2000/2003 Part 1 (I AM ONLY GOING TO TEACH YOU HOW TO MAKE AN
RPG GAME IN THIS TUTORIAL!) First of all, you need to find some resources. When I say
resources, I mean Character Sets, Chip Sets, Music, Backdrops, and Enemies. (Also others) The
perfect place to find thoses would be at one of these great websites: www.gamingw.net
www.phylomortis.com But, before you save them, you need to create a new game. Once you click on
"New Project", this screen will pop up. The Directory Name is simply the name of the folder that
it will....
How To Hide Your Files In XP
hide doc and folders (18) In this tutorial i will show ou how to hide your documents or folders, but you have to remember
where it is! ok lets go! pick a file you want to hide from windows XP, to help you i will
hide a file "hidden.doc" in "C:" open command prompt: START>RUN>CMD you might find yourself in
your user directory. in the command prompt go into the directory of where your file is going to be
hidden. as my "hidden.doc" is in "C:" i will use "cd.." command to "change directory before" till
i get into my C: drive once your there use the attributes command on the file you ar....
Converting Flash Files To Gif
how to convert flash files to anim gif (7) i used swishmax to make simple flash animation. but then, i figured out for simple animations we
should use gif instead. this is to ensure wider compatibility with older browser or those who didnot
have flash installed (for security reasons, etc). so, anyone have a simple solution of coverting SWF
files to GIF files without compromising its quality?. thanks....
Renaming collection of Pictures (files)!
(15) Renaming collection of Pictures (files)! 1- first select your pictures 2- right click on first
picture and select rename 3- type your name 4- press Shift and click on the free space between
first and second Picture 5- see result !....
Looking for creating, executable, jar, files
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for creating, executable, jar, files
|
advertisement
|
|