|
 |
|
 |
12-18-2004, 10:45 AM
|
#1 (permalink)
|
|
[code][/code] enforcer
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
|
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?
__________________
|
|
|
12-18-2004, 11:05 AM
|
#2 (permalink)
|
|
[code][/code] enforcer
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
|
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.
__________________
|
|
|
12-18-2004, 09:01 PM
|
#3 (permalink)
|
|
Java fanboy
Join Date: Aug 2003
Posts: 1,161
|
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.
|
|
|
12-19-2004, 02:03 AM
|
#4 (permalink)
|
|
[code][/code] enforcer
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
|
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.
__________________
|
|
|
12-19-2004, 10:21 AM
|
#5 (permalink)
|
|
Java fanboy
Join Date: Aug 2003
Posts: 1,161
|
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.
|
|
|
12-19-2004, 04:28 PM
|
#6 (permalink)
|
|
[code][/code] enforcer
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
|
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.
__________________
|
|
|
12-20-2004, 01:02 PM
|
#7 (permalink)
|
|
Java fanboy
Join Date: Aug 2003
Posts: 1,161
|
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.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -8. The time now is 04:22 AM.
|
Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
|
 |
|