Solved

Running Java Problem

Posted on 2008-06-16
36
261 Views
Last Modified: 2013-11-23
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?
0
Comment
Question by:bdiddy05
  • 15
  • 10
  • 5
  • +3
36 Comments
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Please post the result of

echo %PATH%
0
 

Author Comment

by:bdiddy05
Comment Utility
Where will that be found?
0
 
LVL 26

Expert Comment

by:souseran
Comment Utility
Go to Start | Run. Type CMD. Press Enter. Type the command in the new screen. Press Enter after you type it.
0
 
LVL 26

Expert Comment

by:souseran
Comment Utility
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.
0
 

Author Comment

by:bdiddy05
Comment Utility
I typed echo %PATH% into the command prompt and the following was displayed:
c:\program files\java\jdk1.6.0_0\bin;C:\GMX
0
 
LVL 26

Expert Comment

by:souseran
Comment Utility
What were the results of trying the steps outlined in the linked article?
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Then you should be able to execute javac at the command line too
0
 

Author Comment

by:bdiddy05
Comment Utility
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.
0
 

Author Comment

by:bdiddy05
Comment Utility
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?
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
>>This is what I tried: "C:\Documents and Settings\Owner>javac

*In the same command window* can you do

echo %PATH%

?
0
 

Author Comment

by:bdiddy05
Comment Utility
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.
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
Does

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

exist?
0
 
LVL 26

Expert Comment

by:souseran
Comment Utility
> 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?
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
The issue is nothing to do with the classpath
0
 
LVL 16

Expert Comment

by:krakatoa
Comment Utility
In a command prompt window, type this exact command and then press enter. Post the results back here:

dir c:\javac.exe /s


0
 
LVL 92

Expert Comment

by:objects
Comment Utility
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"
0
 
LVL 3

Expert Comment

by:sprjp2
Comment Utility
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 ?
0
 

Author Comment

by:bdiddy05
Comment Utility
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
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:bdiddy05
Comment Utility
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
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
did u try running it directly (by entering the full path) as I suggested above?

0
 

Author Comment

by:bdiddy05
Comment Utility
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
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
you'll need to quote it as it contains spaces.
(also quote it in your path)

0
 

Author Comment

by:bdiddy05
Comment Utility
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


0
 
LVL 92

Expert Comment

by:objects
Comment Utility
ok, that worked.
you should just be able to correct your path and it should work ok,

0
 

Author Comment

by:bdiddy05
Comment Utility
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.
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
did u quote it?

0
 

Author Comment

by:bdiddy05
Comment Utility
yes
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
what is your path now?

echo $PATH

0
 
LVL 92

Expert Comment

by:objects
Comment Utility
sorry, echo %PATH%

0
 

Author Comment

by:bdiddy05
Comment Utility
You meant echo %PATH% correct?
"c:\program files\java\jdk1.6.0_06\bin\javac";C:\GMX
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
how ru setting the PATH?

0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
Comment Utility
should be:

"c:\program files\java\jdk1.6.0_06\bin\";C:\GMX
0
 

Author Comment

by:bdiddy05
Comment Utility
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?
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
thats correct, good work :)
0
 

Author Comment

by:bdiddy05
Comment Utility
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.
0
 

Author Closing Comment

by:bdiddy05
Comment Utility
Thank you so much, you rock.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now