Link to home
Start Free TrialLog in
Avatar of bdiddy05
bdiddy05

asked on

Running Java Problem

I am new to Java. Here is my problem I get the error message when I try to run javac. I have jdk1.6.0_06 loctaed in my program files/Java. I checked and I have javac located in the bin of the jdk1.60_06 file. I tried changing the path to c:\program files\java\jdk1.6.0_0\bin but still get the error. Is this the wrong path?
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Please post the result of

echo %PATH%
Avatar of bdiddy05
bdiddy05

ASKER

Where will that be found?
Go to Start | Run. Type CMD. Press Enter. Type the command in the new screen. Press Enter after you type it.
Also, see this Java article:

Setting the class path

http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html

Try following the steps there to see if that fixes the problem for you.
I typed echo %PATH% into the command prompt and the following was displayed:
c:\program files\java\jdk1.6.0_0\bin;C:\GMX
What were the results of trying the steps outlined in the linked article?
Then you should be able to execute javac at the command line too
I didn't think I had to change the class path.
My class path is currently set to: .;C:\Program Files\Java\jre1.5.0_02\lib\ext\QTJava.zip.
This is what I tried: "C:\Documents and Settings\Owner>javac " and then enter. I am still getting the same error message. Am I typing it wrong?
>>This is what I tried: "C:\Documents and Settings\Owner>javac

*In the same command window* can you do

echo %PATH%

?
Yes,
I even closed it and opened a new window. I typed the echo %PATH% (which displayed the same message above) and then javac on the next line.
Still got the same error.
Does

c:\program files\java\jdk1.6.0_0\bin\javac.exe

exist?
> My class path is currently set to: .;C:\Program Files\Java\jre1.5.0_02\lib\ext\QTJava.zip.

Your current class path is set to use the Java Runtime Edition 1.5.0 => jre1.5.0_02

Yet you indicate you are using jdk1.6.0_06

At the command prompt, what is the result if you type SET and press Enter?
The issue is nothing to do with the classpath
In a command prompt window, type this exact command and then press enter. Post the results back here:

dir c:\javac.exe /s


Path should be:

c:\program files\java\jdk1.6.0_06\bin

try also running it directly

"c:\program files\java\jdk1.6.0_06\bin\javac"
Are you sure that the directory is
c:\program files\java\jdk1.6.0_0\bin
and not
c:\program files\java\jdk1.6.0_06\bin ?
Krak,
after inputting dir c:\javac.exe/s the following was shown:
Volume in drive C has no label
Volume Serial NUmber is d006-e60e
I got ahead of myself. Also after inputting the above command this also showed up:
Directory of c:\Program Files\Java\jsk1.6.0\bin
3/25/2008 2:17 AM                     25,600 javac.exe
1 file(s)                                       25,600bytes
0 dir(s)                                      49,961,308,160 bytes free
did u try running it directly (by entering the full path) as I suggested above?

yes I tried running the full path and this is what came up:
c:\Program  is not recgonized as an internal or external command opertable program or batch file
you'll need to quote it as it contains spaces.
(also quote it in your path)

I included the quotes and a whole bunch of stuff came up;
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Owner>"c:\program files\java\jdk1.6.0_06\bin\javac"
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are u
sed
  -classpath <path>          Specify where to find user class files and annotati
on processors
  -cp <path>                 Specify where to find user class files and annotati
on processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compil
ation is done.
  -processor <class1>[,<class2>,<class3>...]Names of the annotation processors t
o run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -implicit:{none,class}     Specify whether or not to generate class files for
implicitly referenced files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release

  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system


ok, that worked.
you should just be able to correct your path and it should work ok,

I changed the path to exactly that. When I go into a new command prompt, I  just type in javac, correct?
I did this and still get the same error.
did u quote it?

yes
what is your path now?

echo $PATH

sorry, echo %PATH%

You meant echo %PATH% correct?
"c:\program files\java\jdk1.6.0_06\bin\javac";C:\GMX
how ru setting the PATH?

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok I changed the path like above and I get the same message:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Owner>javac
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are u
sed
  -classpath <path>          Specify where to find user class files and annotati
on processors
  -cp <path>                 Specify where to find user class files and annotati
on processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compil
ation is done.
  -processor <class1>[,<class2>,<class3>...]Names of the annotation processors t
o run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -implicit:{none,class}     Specify whether or not to generate class files for
implicitly referenced files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release

  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system

Is this correct?
thats correct, good work :)
Wow that was it, do I feel dumb. Two days of going over it and it was just one word I had to change in the PATH.

Thank you so much for the help, you rock.
Thank you so much, you rock.