Home > Archive > Java Help > January 2008 > classpath problem ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
classpath problem ?
|
|
| Frederick Smith 2008-01-27, 8:28 am |
|
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%;%Syst
emRoot%\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
| |
|
| Frederick Smith wrote:
> 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%;%Syst
emRoot%\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?
--
Lew
This post contains requests for six pieces of information.
| |
| Frederick Smith 2008-01-27, 10:38 pm |
|
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
Lew wrote:
> Frederick Smith wrote:
>
> By this, do you mean that you double-click on the entry for the JAR in
> the explorer view?
>
>
> Did you set up a 'Main-Class' in the manifest?
>
>
> 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.
>
>
> Assuming that is a question, probably nothing.
>
>
> 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?
>
| |
|
| Frederick Smith wrote:
> 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?
Frederick Smith wrote:
Lew wrote:[color=darkred]
Frederick Smith wrote:[color=darkred]
> 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.
[color=darkred]
Inquiring minds still want to know - it seems likely that it contains a
'Main-Class' already. The request for this information was not purposeless.
--
Lew
| |
| Sabine Dinis Blochberger 2008-01-28, 9:03 am |
| Frederick Smith wrote:
>
> 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.
--
Sabine Dinis Blochberger
Op3racional
www.op3racional.eu
| |
| brahma.mca07@gmail.com 2008-01-30, 4:59 am |
| On Jan 27, 7:44=A0pm, Lew <l...@lewscanon.com> wrote:
> Frederick Smith wrote:
Windows Explorer,[color=darkred]
>
> By this, do you mean that you double-click on the entry for the JAR in the=
> explorer view?
>
>
> Did you set up a 'Main-Class' in the manifest?
>
>
> You were discussing a run-time problem. =A0What is the difficulty with jav=
ac?
>
> 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.
>
>
> Assuming that is a question, probably nothing.
>
>
[color=darkred]
>
> 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?
>
> --
> 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
|
|
|
|
|