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 / First Aid / January 2008

Tip: Looking for answers? Try searching our database.

classpath problem ?

Thread view: 
Frederick Smith - 27 Jan 2008 14:03 GMT
Hi there

I have installed Netbeans 6.0 on my Win XP platform, which has Java 1.6
installed, and if I try to run an executable jar straight from the
Windows Explorer, I get the "could not find the main class. Program will
exit" message. ( the program runs within the IDE with no problem )

If javac works from the command line with no problems, why is this
happening ?

What do I need to do to the environment variables to sort this out. The
PATH looks like this at the moment

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
Files\Java\jdk1.6.0_03\bin\;C:\Program
Files\Hummingbird\Connectivity\7.10\Accessories\;C:\Program
Files\Microsoft SQL Server\90\Tools\bin\

Thanks in advance

Frederick
Lew - 27 Jan 2008 14:44 GMT
> I have installed Netbeans 6.0 on my Win XP platform, which has Java 1.6
> installed, and if I try to run an executable jar [sic] straight from the Windows Explorer,

By this, do you mean that you double-click on the entry for the JAR in the
explorer view?

> I get the "could not find the main class. Program will
> exit" message. ( the program runs within the IDE with no problem )

Did you set up a 'Main-Class' in the manifest?

> If javac works from the command line with no problems, why is this
> happening ?

You were discussing a run-time problem.  What is the difficulty with javac?

How are you invoking javac?

Whether javac works, "from the command line" or otherwise, has nothing to do
with whether your JAR is set up correctly.

> What do I need to do to the environment variables to sort this out.

Assuming that is a question, probably nothing.

> The PATH looks like this at the moment
>
> %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program
> Files\Java\jdk1.6.0_03\bin\;C:\Program
> Files\Hummingbird\Connectivity\7.10\Accessories\;C:\Program
> Files\Microsoft SQL Server\90\Tools\bin\

Is there a message that you get about not being able to find an executable?

If not, your PATH is likely not related to the problem.

What are the contents of the JAR's manifest?

Signature

Lew
This post contains requests for six pieces of information.

Frederick Smith - 27 Jan 2008 16:37 GMT
1 - Yes - I double click on the .jar in the explorer

2 - No

3 - No difficulty with javac ....

4 - ... which I invoke with "javac filename.java"

5 - No message about lost executables

6 - The program runs OK when I invoke it using "java -jar filename.jar"
- maybe its a file association problem in Windows ?

Frederick

>> I have installed Netbeans 6.0 on my Win XP platform, which has Java
>> 1.6 installed, and if I try to run an executable jar [sic] straight
[quoted text clipped - 34 lines]
>
> What are the contents of the JAR's manifest?
Lew - 27 Jan 2008 17:01 GMT
> 1 - Yes - I double click on the .jar in the explorer

A: Trim-and-inline posting: trim the parts that don't pertain to your
responses, and interject your remarks inline.
Q: What should I do instead?
A: Because it makes it harder to follow the flow of the conversation.
Q: Why is it bad?
A: Placing your response above the entire body of the post to which you are
responding.
Q: What is top-posting?

>>> I get the "could not find the main class. Program will exit" message.
>>> ( the program runs within the IDE with no problem )

Lew wrote:
>> Did you set up a 'Main-Class' in the manifest?

> 2 - No

NetBeans probably did that for you.  Did you check?

> 6 - The program runs OK when I invoke it using "java -jar filename.jar"

More evidence that there is indeed a 'Main-Class' in the manifest.  Did you check?

> - maybe its a file association problem in Windows ?

That seems likely.

>> What are the contents of the JAR's manifest?

Inquiring minds still want to know - it seems likely that it contains a
'Main-Class' already.  The request for this information was not purposeless.

Signature

Lew

brahma.mca07@gmail.com - 30 Jan 2008 05:30 GMT
> > I have installed Netbeans 6.0 on my Win XP platform, which has Java 1.6
> > installed, and if I try to run an executable jar [sic] straight from the Windows Explorer,
[quoted text clipped - 37 lines]
> Lew
> This post contains requests for six pieces of information.

hi
i hav faced  same envirement problem..........& it was happend
because of verseioning in java ...........the jar file you try to run
on Java1.5 it will definately run directly with out going through
command prompt
Sabine Dinis Blochberger - 28 Jan 2008 11:39 GMT
> Hi there
>
> I have installed Netbeans 6.0 on my Win XP platform, which has Java 1.6
> installed, and if I try to run an executable jar straight from the
> Windows Explorer, I get the "could not find the main class. Program will
> exit" message. ( the program runs within the IDE with no problem )

Try a clean build. This sometimes happens to me too.

Signature

Sabine Dinis Blochberger

Op3racional
www.op3racional.eu



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.