Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 12-18-2004, 10:45 AM   #1 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Running apps outside IDE

I've created a default application (wich does nothing at all) with the Netbeans IDE (4.0 beta 2).
When I try to run the jar file through the console command...
javaw -jar blah.jar
...I get a dialog box popping up:
could not find main class.
Yet the manifest is automatically created and packed into the jar file as well, so what could be wrong?

And how do I distribute a stand-alone java coded application so the clients only needs to double click to start up the application. For example are there any tools outthere that convert these files into an exe or do things automatically?
__________________
Valmont is offline   Reply With Quote
Old 12-18-2004, 11:05 AM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Well, I can solve the latter, but the error: could not find main class
still remains. I don't understand why. What step is missing?
I could upload the jar for you to unzip and check out if you will.
__________________
Valmont is offline   Reply With Quote
Old 12-18-2004, 09:01 PM   #3 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
While I don't know if it'll do anything, try using "java" instead of "javaw". I'm not really clear on the differences, but "java" is the regular VM.

Now, first thing; you do have a class with "static public void main(String[] args)" in it, correct?

As for just double-clicking, the user should be able to do that provided they have the "JRE" installed; it's basically the same thing you downloaded only without source and the ability to compile. It can be downloaded from Sun as well. If this doesn't work for you, let me know, as I have a set-by-step tutorial I made for my employer.

Feel free to upload the jar.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 12-19-2004, 02:03 AM   #4 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Quote:
Now, first thing; you do have a class with "static public void main(String[] args)" in it, correct?
Yes I do. The Jar file holds also a manifest.mf file. In there the entry point for the main is defined correctly. Nevertheless the VM can't find it.

Let me upload the jar file. You can extract it and see for your self:
Download jar here.
__________________
Valmont is offline   Reply With Quote
Old 12-19-2004, 10:21 AM   #5 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
Here's the command I ran: "java -jar omfg.jar". It ran without output, which makes sense, as you didn't have anything in the main method. So I think the jar itself is fine; there must be a problem with your environment.

Double-check your CLASSPATH variable, and make sure that you have included ".", as that's a pretty common error that will result in Java complaining about not being able to find files. It really shouldn't matter in the case of a Jar, but you might want to double-check.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 12-19-2004, 04:28 PM   #6 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Hmm, when I use the Java 2 runtime Java.exe then it works...

So what is a "j2re1.4.1_03"?
It was using the java.exe from that first until I installed JRE2 1.4. NOw it's using the java.exe from the Java 2 runtime environment.
__________________
Valmont is offline   Reply With Quote
Old 12-20-2004, 01:02 PM   #7 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
If you hadn't installed Java before, I'm not sure where it's from, but I have a guess. It might be the court-mandated install of Sun's JVM by Microsoft.

j2re1.4.1_03 is a version of Java that's actually a bit out of date, as the most recent j2re1.4.x is 1.4.2_0-something-or-other.

In a more general sense, everything after Java 1.1 is labeled as Java2 (hence the "j2"). It's just dumb marketing by Sun. It makes sense in a way, since there was a major overhaul of the core library in Java 1.2, but they could have kept everything nice and simple and just called it Java 1.2. Now, with the release of Java 1.5, they've started calling it Java5, but it's also Java2, which in the grand scheme of things means jack squat; it's Java 1.x, with 1.5 being the most recent, although a lot of people still use 1.4. If you just say "Java One-Five", everyone who talks Java (at least, everyone who isn't a bull**** artist) knows exactly what you're talking about.

Ok, with that confusing corporate-speak explaination out of the way, if it's labeled "j2re", that means it's the Runtime Environment. The Runtime Environment contains only what is necessary to run Java programs. The "SDK" contains both the Runtime Environment, and everything necessary to create Java programs.
__________________
GitS
Belisarius is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling And Running freesoft_2000 Java 13 12-12-2004 11:34 AM
IDE Discussion sde Java 14 08-25-2004 05:32 AM
running a script at designated time tzarin PHP 5 05-12-2004 07:11 PM
Knowing your IDE sde Program Design and Methods 12 12-30-2003 03:10 AM
running PHP in a specific directory? Admin PHP 1 04-24-2003 06:27 PM


All times are GMT -8. The time now is 04:22 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting