Solved

Running Java Problem

Posted on 2008-06-16
36
267 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
ID: 21796887
Please post the result of

echo %PATH%
0
 

Author Comment

by:bdiddy05
ID: 21796902
Where will that be found?
0
 
LVL 26

Expert Comment

by:souseran
ID: 21796957
Go to Start | Run. Type CMD. Press Enter. Type the command in the new screen. Press Enter after you type it.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 26

Expert Comment

by:souseran
ID: 21796985
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
ID: 21797085
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
ID: 21797117
What were the results of trying the steps outlined in the linked article?
0
 
LVL 86

Expert Comment

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

Author Comment

by:bdiddy05
ID: 21797148
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
ID: 21797174
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
ID: 21797314
>>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
ID: 21797403
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
ID: 21797503
Does

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

exist?
0
 
LVL 26

Expert Comment

by:souseran
ID: 21797700
> 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
ID: 21797732
The issue is nothing to do with the classpath
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 21798090
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
ID: 21798404
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
ID: 21798439
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
ID: 21798637
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
 

Author Comment

by:bdiddy05
ID: 21798651
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
ID: 21798684
did u try running it directly (by entering the full path) as I suggested above?

0
 

Author Comment

by:bdiddy05
ID: 21798731
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
ID: 21798736
you'll need to quote it as it contains spaces.
(also quote it in your path)

0
 

Author Comment

by:bdiddy05
ID: 21798766
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
ID: 21798770
ok, that worked.
you should just be able to correct your path and it should work ok,

0
 

Author Comment

by:bdiddy05
ID: 21798791
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
ID: 21798804
did u quote it?

0
 

Author Comment

by:bdiddy05
ID: 21798807
yes
0
 
LVL 92

Expert Comment

by:objects
ID: 21798818
what is your path now?

echo $PATH

0
 
LVL 92

Expert Comment

by:objects
ID: 21798820
sorry, echo %PATH%

0
 

Author Comment

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

Expert Comment

by:objects
ID: 21798841
how ru setting the PATH?

0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 21798844
should be:

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

Author Comment

by:bdiddy05
ID: 21798865
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
ID: 21798870
thats correct, good work :)
0
 

Author Comment

by:bdiddy05
ID: 21798876
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
ID: 31467739
Thank you so much, you rock.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 115
VB Script to add site to Java Exception List 4 76
how to install java on RHEL image on EC2 4 26
hibernate jars 4 28
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

786 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