Making Jar files Run
By Pete Freitag
I recently had to reinstall my OS, and more recently had to use a Java Application called JEdit. JEdit's installer didn't create any shortcuts for me, so I had to run JEdit from the command line by invoking it's jar file with java -jar jEdit.jar
. Since I had just installed java, it was not part of my system path yet, so I actually had to run something like this C:\j2sdk1.4.2_02\bin\java -jar jEdit.jar
, quite a pain but it got me thinking about somethings that could be done by Sun when I installed the JVM that would have made my life a lot easier.
First they could have given me the option to add C:\j2sdk1.4.2_02\bin\ to my system PATH. What java developer want's to update this every time they install in new JDK, along with the JAVA_HOME environment variable that some java apps need (like Ant)?
The second issue: why don't jar files execute when you double click them? This turns out to be a fairly easy workaround for someone who knows what they are doing, you just need to set javaw.exe to execute jar files. That is easy for a software developer, but wouldn't it be easier if the JVM did this for you when it was insatlled? Software developers could just say: download this jar file and double click it to run!
If anyone has contacts at Sun, please feel free to forward my comments to them! I'm not just complaining, I'd like to see Java easier to use and more appealing for desktop apps.
Making Jar files Run was first published on November 14, 2003.
If you like reading about java, jar, or jvm then you might also like:
- Java LTS Versions Explained with EOL Dates
- Updating Java on ColdFusion or Lucee
- ColdFusion Heap / Non-Heap Memory Usage Script
- Adobe Says Go Ahead and Upgrade your ColdFusion JVM
Weekly Security Advisories Email
Advisory Week is a new weekly email containing security advisories published by major software vendors (Adobe, Apple, Microsoft, etc).
Comments
jar cmf SW1.txt Tset.jar SWTHelloWorld.class SWTHelloWorld.java
by executing this command, the jar files gets generated, but when i double click on the Test.jar, it gives the error,"Could not fine the main Class, program will exit". when i look at the meta-inf/manifest.mf file its ok
Manifest-Version: 1.0
Class-Path: Test1.jar
Created-By: 1.4.2_03 (Sun Microsystems Inc.)
Main-Class: SWTHelloWorld
but it islocate in C:\Documents and Settings\103022270\Local Settings\Temp\Manifest.mf
What could be the problem. please guide me.
I am in urgent need
thanks in advance
Basant
Also, by default, the windows install provides a "Executable Jar" file type so that double clicking on a jar executes it using javaw.exe
now HOW COULD I ENCOUNTER THIS PROBLEM, any help will be greatly apperiterited on my mail. thanks. ...
i created one package
c:\jdk1.5.0\bin\pack>dir
hello.java
hello.class
after i created 1 manifest file
md meta-inf
cd meta-inf
c:\jdk1.5.0\bin\pack\meta-manifest.mf>
mainfest-version: 1.0
main-class: hello
after i xtract
and then , i run it, failed to load
manifest class, but jar format the file is created.
plz help me,
help me...tis so important.thanks
pls help me !!!
1.Main-Class: any
2.must be carrige return
3.must blank space between :& classFile
It good in Java ,but jar file should"handle with care"
warm regards
mirza
any one can send why we are moving to
GenericServlet to HttpServlet any reason???
So many mems saying tht GenericServlet is Protocol independent tht means Http protocol is also there in GenericServlet na .Then why we want to go to HttpServlet.
and
wht is the difference between GenericServlet and HttpServlet...Send me a mai to:
srikanth_nlr_p@yahoo.com
Thanks in advance
Srikanth.P
evezhang1@yahoo.com
at sun.awt.shell.Win32ShellFolder2$ComTask.execute(Win32ShellFolder2.jav
a:1214)
at sun.awt.shell.Win32ShellFolder2.getFileSystemPath(Win32ShellFolder2.j
ava:557)
at sun.awt.shell.Win32ShellFolder2.composePathForCsidl(Win32ShellFolder2
.java:211)
at sun.awt.shell.Win32ShellFolder2.<init>(Win32ShellFolder2.java:224)
at sun.awt.shell.Win32ShellFolderManager2.getDesktop(Win32ShellFolderMan
ager2.java:87)
at sun.awt.shell.Win32ShellFolderManager2.get(Win32ShellFolderManager2.j
ava:187)
at sun.awt.shell.ShellFolder.get(ShellFolder.java:218)
at javax.swing.filechooser.FileSystemView.getRoots(FileSystemView.java:3
63)
at javax.swing.plaf.metal.MetalFileChooserUI.updateUseShellFolder(MetalF
ileChooserUI.java:430)
at javax.swing.plaf.metal.MetalFileChooserUI.installComponents(MetalFile
ChooserUI.java:189)
at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserU
I.java:136)
at javax.swing.plaf.metal.MetalFileChooserUI.installUI(MetalFileChooserU
I.java:124)
at javax.swing.JComponent.setUI(JComponent.java:673)
at javax.swing.JFileChooser.updateUI(JFileChooser.java:1762)
at javax.swing.JFileChooser.setup(JFileChooser.java:360)
at javax.swing.JFileChooser.<init>(JFileChooser.java:333)
at javax.swing.JFileChooser.<init>(JFileChooser.java:286)
at ltry.actionPerformed(ltry.java:56)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
95)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
istener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322
)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.security.AccessControlException: access denied (java.lang.Runtim
ePermission shutdownHooks)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:323)
at java.security.AccessController.checkPermission(AccessController.java:
546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.Runtime.addShutdownHook(Runtime.java:190)
at sun.awt.shell.Win32ShellFolder2$ComTaskExecutor.<init>(Win32ShellFold
er2.java:1165)
at sun.awt.shell.Win32ShellFolder2$ComTaskExecutor.<clinit>(Win32ShellFo
lder2.java:1156)
... 42 more
I think there is something wrong with the environment variable.
can anyone tell me what do i have give in the environment variables.
C:\>java -jar "The_Law__Ketan__18-6.jar"
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/layout/G
roupLayout$Group
Caused by: java.lang.ClassNotFoundException: org.jdesktop.layout.GroupLayout$Gro
up
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
please give me solution
i built jar of my project. its working fine in windows but giving error - Null Peer?! Exception in Linux.
Please enlighten me on what's going on and possible workarounds.
thanks in advance!
Please help me to execute a jar file for running my java file and how I create a .exe file.
to know how, enail me on: vivekdhar50@yahoo.com
PLZ HELP ME
java.exe -jar %1 %
Tell NOTEPAD to save as - tell it in the save as type All Files(*.*) and in the file name area name it Javawindows.bat
REMEMBER that file location you were told to remember... save it there.
Now goto the folder where you have the jar file you want to run highlight it and right click and choose open with - tell it to open with the bat file you just made... you will have to browse to it click ok. and your ready to double click on any jar file in windows and have it open.
My problem are i am create java .jar file by help net-beans foe dist folder but i have double click in these jar file they will open as compress folder. So please give any suggestion how to create java executable file
i am working on net beans 1.6.7 using category
Mobile application i complete one projects but
when i double click on execute able jar.file it give me error failed to
load-main class manifest attribute.
Sir tell me this project is It complete or not ?.
I think i missing somethings in this project. sir
tell me how to solve this problem.And Also guide me how to make jar file for mobile which can run for mobiles. using with net beans 1.6.7
Actually I have made execute able jar files but i can`t get mobile.jar file
how can i solve this problem pls send me in ashlinrejo1@gmail.com
plz hep me..
plz help me!!
combinations, and you should trace those LCs that can be trusted on charts tout de suite
reoccur improve of later reference. Authorized crossovers can be trusted in the chap infrastructure, and prohibited crossovers
cannot be trusted. Over again, verboten crossovers are interpreted near clashing traders who gather into work
old signals such as pivots as an access, again causing losses.
iam giving here an example
.after u creating jar file by using
jar -cfm name.jar main.class
.
Here name.jar is the name of jar file
.
Main.class is the name of the main class
.
After created u open by right clicking in winrar or other and change the content of
"manifest.mf"
.edit in new line
Main-class:name
.
Here name is the name of main class
.
Then save and try to re open it by double click..
Voila u hav created
java -jar QCentral.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
can someone help me, where to get the JAR software for X201 nokia mobile, word, and PDF file are not accessable, what i wan is to change it JAR, but i need the software to installation.
Thank you,by advance,
C:\Program Files (x86)\JavaEmulator.com\KEmulator>java -cp KEmulator.jar emulato
r.Emulator
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files (x86
)\JavaEmulator.com\KEmulator\swt-win32-3346.dll: Can't load IA 32-bit .dll on a
AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(Unknown Source)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at emulator.k.a(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at emulator.ui.swt.aK.<init>(Unknown Source)
at emulator.Emulator.main(Unknown Source)
I tried to run KEmulator in manny ways, but still can't spot the error.. Please e-mail me asap... :)