Results 1 to 5 of 5
- 04-06-2012, 07:16 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
Unable to compile/run java on the command line...but it works fine in eclipse
I have been using eclipse to create java programs for over a year, but a class I am taking now requires that we use the command line to compile and run our code. For some reason, when I try to compile code it tells me:
'javac.exe' is not recognized as an internal or external command, operable program or batch file.
I have looked at several posts on this topic, and so I assume that there is probably a problem with my PATH variable..but I was unable to fix the problem
my path is:
bin;C:\Program Files (x86)\Haskell Platform\2011.4.0.0\lib\extralibs\bin;C:\Program Files (x86)\Haskell Platform\2011.4.0.0\bin;%CommonProgramFiles%\Micro soft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoo t%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowe rShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\jdk1.6.0_21\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x86)\ruby-1.9.3\bin;C:\Program Files (x86)\git\bin;C:\Program Files (x86)\git\cmd;C:\Dwimperl\perl\bin;C:\Dwimperl\per l\site\bin;C:\Dwimperl\c\bin;C:\strawberryperl\c\b in;C:\strawberryperl\perl\site\bin;C:\strawberrype rl\perl\bin
As you may be able to tell...I also had some trouble installing perl...I should probably clean that up.
The path to my jdk bin is correct, javac should be there.
It isn't something I messed up recently, I can still use eclipse to compile and run my programs with no problems.
I'm lost, and I don't know much about what system variable are or what they mean, so I am hesitant to jump in and mess around with them. I followed precise instructions to install java, and haven't touched it since (Although it seems to have been automatically changed when I installed perl, haskell, etc.) Does anyone know what the problem is?Last edited by kickserve; 04-06-2012 at 07:19 AM.
- 04-06-2012, 07:43 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
Re: Unable to compile/run java on the command line...but it works fine in eclipse
Can you confirm that you got this path by typing
at the command line (terminal)? Or say how you know this is the path. (*)Java Code:path
Also can you confirm that javac.exe is where it should be, with the following commands:
[Edit] * In fact it would be a good idea to copy and post the exact and entire output obtained from executing the path command.Java Code:"C:\Program Files\jdk1.6.0_21\bin\javac.exe" -version dir "C:\Program Files\jdk1.6.0_21\bin\java*.exe"
- 04-06-2012, 07:56 AM #3
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
Re: Unable to compile/run java on the command line...but it works fine in eclipse
I found the path by going to computer -> properties -> advanced system settings -> environment variables. By typing path in the terminal I get:
C:\Users\David Curtis>path
PATH=bin;C:\Program Files (x86)\Haskell Platform\2011.4.0.0\lib\extralibs\bin;C:
\Program Files (x86)\Haskell Platform\2011.4.0.0\bin;%CommonProgramFiles%\Micro s
oft Shared\Windows Live;C:\windows\system32;C:\windows;C:\windows\Sys tem32\Wbem;
C:\windows\System32\WindowsPowerShell\v1.0\;C:\Pro gram Files (x86)\ATI Technolog
ies\ATI.ACE\Core-Static;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Fi
les\jdk1.6.0_21\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Hero
ku\bin;C:\Program Files (x86)\ruby-1.9.3\bin;C:\Program Files (x86)\git\bin;C:\P
rogram Files (x86)\git\cmd;C:\Dwimperl\perl\bin;C:\Dwimperl\per l\site\bin;C:\Dwi
mperl\c\bin;C:\strawberryperl\c\bin;C:\strawberryp erl\perl\site\bin;C:\strawberr
yperl\perl\bin;C:\Users\David Curtis\AppData\Roaming\cabal\bin
which seems pretty similar to what I had originally, but with a bit extra.
Version works correctly (I think):
C:\Users\David Curtis>"C:\Program Files\jdk1.6.0_21\bin\javac.exe" -version
javac 1.6.0_21
C:\Users\David Curtis>dir "C:\Program Files\jdk1.6.0_21\bin\java*.exe"
Volume in drive C has no label.
Volume Serial Number is some hexadecimal number
Directory of C:\Program Files\jdk1.6.0_21\bin
09/23/2010 07:50 PM 32,256 java-rmi.exe
09/23/2010 07:50 PM 165,888 java.exe
09/23/2010 07:50 PM 33,792 javac.exe
09/23/2010 07:50 PM 33,792 javadoc.exe
09/23/2010 07:50 PM 33,792 javah.exe
09/23/2010 07:50 PM 33,792 javap.exe
09/23/2010 07:50 PM 165,888 javaw.exe
09/23/2010 07:50 PM 183,296 javaws.exe
8 File(s) 682,496 bytes
0 Dir(s) 60,632,526,848 bytes free
Everything looks to be in order to me, but I don't know what to look for I suppose.
- 04-06-2012, 08:20 AM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
Re: Unable to compile/run java on the command line...but it works fine in eclipse
Looks fine to me, too. (The reason why there is more stuff shown in the path is that some is system wide and some is per-user).
At least you should be able to compile now: by using "C:\Program Files\jdk1.6.0_21\bin\javac.exe" in place of javac. But it's a pain to have to type that. Perhaps someone else can spot something. Your path is somewhat longer than mine and perhaps that is a problem.
- 04-06-2012, 08:30 AM #5
Member
- Join Date
- Apr 2012
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Open a URL and read it line by line (Works in Eclipse but not from Command Line)
By rosco544 in forum NetworkingReplies: 16Last Post: 09-17-2011, 02:41 AM -
GUI app works in NetBeans, doesn't from command line
By jpmaia in forum NetBeansReplies: 3Last Post: 04-15-2010, 02:41 AM -
[SOLVED] Compile from the command line
By GilaMonster in forum New To JavaReplies: 8Last Post: 06-13-2008, 07:12 AM -
Unable to execute command line command in java
By LordSM in forum New To JavaReplies: 1Last Post: 08-08-2007, 12:23 AM -
Java Command Line Arguments In Eclipse IDE
By JavaForums in forum EclipseReplies: 0Last Post: 05-19-2007, 09:45 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks