Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Double-Clickable Jar File/NetBeans 4.1

Reply
Thread Tools

Double-Clickable Jar File/NetBeans 4.1

 
 
Mark H
Guest
Posts: n/a
 
      06-29-2005
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

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      06-29-2005
On 29 Jun 2005 09:31:22 -0700, Mark H wrote:

> 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 ]

--
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
 
Reply With Quote
 
 
 
 
Richard F.L.R.Snashall
Guest
Posts: n/a
 
      06-29-2005
Mark H wrote:
> 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:
>


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.)
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      06-29-2005
On Wed, 29 Jun 2005 18:38:27 GMT, Andrew Thompson wrote:

>> 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?

--
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
 
Reply With Quote
 
Tjerk Wolterink
Guest
Posts: n/a
 
      06-29-2005
Mark H wrote:
> 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
>


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.
 
Reply With Quote
 
Mark H
Guest
Posts: n/a
 
      06-29-2005
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

 
Reply With Quote
 
Robert kebernet Cooper
Guest
Posts: n/a
 
      06-29-2005
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.

Mark H wrote:
> 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


 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      06-29-2005
On 29 Jun 2005 15:34:53 -0700, Mark H wrote:

> 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

--
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java -cp a.jar -jar b.jar => Works on Windows, not on Debian cyberco Java 4 02-14-2006 06:27 AM
jaas.jar, jta.jar jdbc-stdext.jar missing from jdk1.5 RPM muttley Java 0 10-20-2005 02:40 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters Java 0 01-05-2005 10:59 PM
Differences of xercesImpl.jar, xercesImpl-J.jar, dom3-xercesImpl.jar ? Arnold Peters XML 0 01-05-2005 10:59 PM
Jar file cannot find main class - gfSetup.jar (0/1) James Alan Farrell Java 6 01-09-2004 12:40 PM



Advertisments