Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

Double-Clickable Jar File/NetBeans 4.1

Thread view: 
Mark H - 29 Jun 2005 17:31 GMT
I just got started with NetBeans 4.1 yesterday.

I want to make a double-clickable jar file, but whenever I try opening
the .jar in Windows Explorer, I get the error message:

====================================
Java Virtual Machine Launcher
Could not find the main class. Program will exit!
====================================

I unzipped the jar file to see what was wrong and it looks like
everything is okay. Here is my ./META-INF/MANIFEST.MF file:

====================================
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
Main-Class: edu.ccp.its.inventory.SwInvMerge
X-COMMENT: Main-Class will be added automatically by build
====================================

The class file is stored in
\edu\ccp\its\inventory\SwInvMerge.class

(Note the Windows path)

It looks like this should be working but it doesn't. Any thoughts?

FWIW, I can run the application from NetBeans and from the command line
just fine. I'm just trying to add the option of double-clicking so that
user's aren't forced to use the command prompt.

Thanks, Mark
Andrew Thompson - 29 Jun 2005 19:38 GMT
> I just got started with NetBeans 4.1 yesterday.

Oh, the power.  (rolls eyes)

> I want to make a double-clickable jar file,

So, an application (as opposed to an applet)?

>.. but whenever I try opening
> the .jar in Windows Explorer, I get the error message:

If it is 'double-click' it is an application, IE
will not open it unless the class with a main()
is also an applet, and then only in a web page.

The first thing to figure here is, is this an
application or an applet (or both).

[ By the way.  I recommend you put aside both NetBeans and
applets (if that is what you are attempting) for the moment,
and post messages to a better group for Java beginners -
comp.lang.java.help ]

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Andrew Thompson - 29 Jun 2005 19:56 GMT
>> the .jar in Windows Explorer, I get the error message:
>
> If it is 'double-click' it is an application, IE ...

..wait -Windows- Explorer, not -Internet- Explorer.
Missed that subtle distinction.  

..but now that I peruse your post much more carefully..

>> The class file is stored in
>> \edu\ccp\its\inventory\SwInvMerge.class

Can you successfully run this class from the command line?
(No jar)

..and does your manifest have a blank line at the end?

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Richard F.L.R.Snashall - 29 Jun 2005 19:48 GMT
> I just got started with NetBeans 4.1 yesterday.
>
[quoted text clipped - 8 lines]
> I unzipped the jar file to see what was wrong and it looks like
> everything is okay. Here is my ./META-INF/MANIFEST.MF file:

Did you try (in NetBeans) < source packages >< properties >< running
project > and then setting the main class?  (I think you may have
to "clean" before rebuilding, though.)
Tjerk Wolterink - 29 Jun 2005 21:33 GMT
> I just got started with NetBeans 4.1 yesterday.
>
[quoted text clipped - 29 lines]
>
> Thanks, Mark

Does "java -jar yourjar.jar" work?
If so you probably have the deafult handler of .jar files wrong.
It can be set in file-options in explorer.
Mark H - 29 Jun 2005 23:34 GMT
Thanks,

I changed the default handler and now it works smoothly. Does Windows
usually have the wrong one selected? I'd like for people to be able to
download my program and run it without having to worry about setting
the handler.

Thanks again, Mark
Robert kebernet Cooper - 29 Jun 2005 23:57 GMT
I would highly, *highly* recommend using Java WebStart then. It
atomagically handles things like JRE version, creates Star Menu/Desktop
Icons and makes it much easier to distrubute dependency libraries than
an executable jar file.

> Thanks,
>
[quoted text clipped - 4 lines]
>
> Thanks again, Mark
Andrew Thompson - 30 Jun 2005 00:02 GMT
> I changed the default handler and now it works smoothly. Does Windows
> usually have the wrong one selected?

No.  It works here in Windows Explorer by double clicking the jar.
(And I did not do anything to set up handlers)

Note that the top entry on 'open with' is
 Java (TM) 2 Platform Standard Edition Binary

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.