|
|
| Sampath 2007-04-17, 10:07 pm |
| I have installed j2sdk 1.5 under Windows 2000 (sp3). When I execute
the jfc demo programs, a message appears saying "could not find the
main class, program will exit". But they run well in browser. Someone
please pay attention to my problem.
| |
| Joshua Cranmer 2007-04-17, 10:07 pm |
| Sampath wrote:
> I have installed j2sdk 1.5 under Windows 2000 (sp3). When I execute
> the jfc demo programs, a message appears saying "could not find the
> main class, program will exit". But they run well in browser. Someone
> please pay attention to my problem.
>
How are you executing the Java program?
| |
| TideRider 2007-04-17, 10:07 pm |
| Programs run in the browser are called Applets, they must extend the Applet class. Their main execution
path is a method called start().
Java programs, on the other hand, contain a static method called main(), and that is the overall execution path.
Applets operate in a completely different, carefully restricted, environment than programs.
--
TideRider
"Sampath" <67.sampath@gmail.com> wrote in message news:1176819200.719564.74260@p77g2000hsh.googlegroups.com...
|I have installed j2sdk 1.5 under Windows 2000 (sp3). When I execute
| the jfc demo programs, a message appears saying "could not find the
| main class, program will exit". But they run well in browser. Someone
| please pay attention to my problem.
|
| |
|
|
| TideRider 2007-04-18, 7:08 pm |
|
"Andrew Thompson" <u32984@uwe> wrote in message news:70ddf2beae1fa@uwe...
| TideRider wrote:
| ..
| Please refrain from top-posting. I find it most confusing.
| <http://www.physci.org/codes/javafaq.html#toppost>
Sorrry. It's the default behavior of my newsreader, and I don't always remember which
newgroups prefer top- or bottom- posting. I'm usually more focused on the question
I'm trying to address.
| >Applets operate in a completely different, carefully restricted, ..
|
| Unless the code is signed by the deployer and trusted by
| the end user. In that case, full access is granted.
Valid point. Nevertheless, in the context of the original question, an Applet is
quite different from an application in terms of how it executes.
| > ..environment than programs.
|
| --
| Andrew Thompson
| http://www.athompson.info/andrew/
|
| Message posted via JavaKB.com
| http://www.javakb.com/Uwe/Forums.as...-setup/200704/1
|
| |
| Sampath 2007-04-18, 7:08 pm |
| On Apr 18, 1:55 am, Joshua Cranmer <Pidgeo...@epenguin.zzn.com> wrote:
> Sampath wrote:
>
> How are you executing the Java program?
Double clicking
| |
| Sampath 2007-04-18, 7:08 pm |
| On Apr 18, 7:43 am, "TideRider" <4me2k...@noyb.com> wrote:
> Programs run in the browser are called Applets, they must extend the Applet class. Their main execution
> path is a method called start().
>
> Java programs, on the other hand, contain a static method called main(), and that is the overall execution path.
>
> Applets operate in a completely different, carefully restricted, environment than programs.
>
> --
> TideRider
>
I face no problem executing applets. My problem is all about .jar
files.When I double click them, above mentioned message appears. But
the applet version of the same program(.html file) runs well.
| |
| RedGrittyBrick 2007-04-18, 7:08 pm |
| Sampath wrote:
> I have installed j2sdk 1.5 under Windows 2000 (sp3). When I execute
> the jfc demo programs, a message appears saying "could not find the
> main class, program will exit".
Perhaps because your example programs don't have a method named "main".
Have you checked the source code for a "public static void main(String[]
args { ... }".
> But they run well in browser.
Presumably because applets have no need of a "main" method.
> Someone please pay attention to my problem.
No need to ask. People pay attention only if the problem is well stated
and looks interesting. No amount of pleading will change that.
| |
| Sampath 2007-04-19, 7:08 pm |
| On Apr 19, 2:00 am, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
wrote:
> Sampath wrote:
>
> Perhaps because your example programs don't have a method named "main".
> Have you checked the source code for a "public static void main(String[]
> args { ... }".
>
>
> Presumably because applets have no need of a "main" method.
>
>
> No need to ask. People pay attention only if the problem is well stated
> and looks interesting. No amount of pleading will change that.
They certainly have a main method because I'm talking about the
example programs comes with J2SDK 1.5 . Today I found that my
programs
execute by "java" command without trouble. Problem seems to be with
the CLASSPATH system variable because there's no such variable in the
list. As I know the are automatically created with JDK installation.
But nothing has created.
| |
| Andrew Thompson 2007-04-19, 7:08 pm |
| Sampath wrote:
>On Apr 19, 2:00 am, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
>wrote:
That message above is coming from Java itself.
...[color=darkred]
>They certainly have a main method because I'm talking about the
>example programs comes with J2SDK 1.5 . Today I found that my
>programs
>execute by "java" command without trouble.
Did you make the jar yourself? It sounds as though the
jar lacks a manifest the identifies the main class.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via http://www.javakb.com
| |
| Sundar 2007-04-20, 4:14 am |
| >
> Did you make the jar yourself? It sounds as though the
> jar lacks a manifest the identifies the main class.
Yes, It is the likely cause of the error i.e. missing manifest file.
Since sampat is running an example file I guess the jar file is not
created by him.
-Sundar
| |
| Sampath 2007-04-21, 10:09 pm |
| On Apr 19, 8:35 pm, "Andrew Thompson" <u32984@uwe> wrote:
> Sampath wrote:
>
> That message above is coming from Java itself.
> ..
>
>
> Did you make the jar yourself? It sounds as though the
> jar lacks a manifest the identifies the main class.
>
No they are example programs that come with JDK.
How about CLASSPATH variable ?
At the moment there's no such variable in environment variables list.
Tell me how to configure it.
> --
> Andrew Thompsonhttp://www.athompson.info/andrew/
>
> Message posted viahttp://www.javakb.com
| |
| Andrew Thompson 2007-04-21, 10:09 pm |
| Sampath wrote:
...
Andrew Thompson wrote:
>
>No they are example programs that come with JDK.
I am still not clear what you mean. Both .java source
files, and .jar's might be referred to as 'programs'.
Can you upload the .jar to a server and give us a link?
Alternately, run the command ..
jar -tf TheNameOfThe.jar
..and report the output.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.as...-setup/200704/1
| |
|
|
| Sampath 2007-04-23, 7:08 pm |
| On Apr 20, 12:55 pm, Sundar <sundar2...@gmail.com> wrote:
> Yes, It is the likely cause of the error i.e. missing manifest file.
what is manifest file? is that included in the .jar archive or is that
a file in the java environment?
> Since sampat is running an example file I guess the jar file is not
> created by him.
>
> -Sundar
| |
| Sampath 2007-04-23, 7:08 pm |
| On Apr 20, 12:55 pm, Sundar <sundar2...@gmail.com> wrote:
> Yes, It is the likely cause of the error i.e. missing manifest file.
what is manifest file? is that included in the .jar archive or is that
a file in the java environment?
> Since sampat is running an example file I guess the jar file is not
> created by him.
>
> -Sundar
| |
|
|
|
| Sampath wrote:
> what is manifest file? is that included in the .jar archive or is that
> a file in the java environment?
Take a look at Andrew's answer to your first post of the question.
--
Lew
|
|
|
|