1,105,556 Community Members

javac doesn't work

Member Avatar
gzero14
Newbie Poster
13 posts since Jul 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I've tried using the javac command inside the command prompt but it says "javac not recognized as an internal or external command". the java command works perfectly fine.

On the other hand, I can compile stuff using the Textpad program.
Anyone know why this might be happening?

Version of Java SDK: 1.5.0_04

Member Avatar
server_crash
Postaholic
2,106 posts since Jun 2004
Reputation Points: 64 [?]
Q&As Helped to Solve: 29 [?]
Skill Endorsements: 28 [?]
 
0
 

You haven't set your classpath.

Member Avatar
gzero14
Newbie Poster
13 posts since Jul 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Do you mean the thing in environmental variables?

".;%classpath%.;C:\Program Files\Java\jdk1.5.0_04\lib\tools.jar"
From reading some other topics...and doing that fixed the thing with none of my java applications working properly. But javac still doesn't work.

Member Avatar
server_crash
Postaholic
2,106 posts since Jun 2004
Reputation Points: 64 [?]
Q&As Helped to Solve: 29 [?]
Skill Endorsements: 28 [?]
 
0
 

Put a period at the end of your classpath so that it looks like this:

.;%classpath%.;C:\Program Files\Java\jdk1.5.0_04\lib\tools.jar.

I must warn you though, recently I've learned that setting the classpath variable to tools.jar isn't the best way to do it anymore. It will still work, but it's not recommended by professionals.

Member Avatar
gzero14
Newbie Poster
13 posts since Jul 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I guess I'll do that for now then, but what's the better way?

Edit: javac still doesn't work. In fact, I lost the ability to run java applications so I'm changing it back...

Member Avatar
server_crash
Postaholic
2,106 posts since Jun 2004
Reputation Points: 64 [?]
Q&As Helped to Solve: 29 [?]
Skill Endorsements: 28 [?]
 
0
 

I'm not sure why that's not working, unless you have more to your classpath. If that's the case, be sure the seperate using a semi-colon(;).

The other(better) way...I really don't know much about it.
See this thread for a little help:

http://www.daniweb.com/techtalkforums/thread26307.html

I really can't help you much with that though. I'm sure Mr. Wenting would be willing to help if you ask.

Member Avatar
gzero14
Newbie Poster
13 posts since Jul 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hmm that way works, lets me run the app and stuff but the javac command still refuses to work...I don't think it has anything to do with the classpath if I'm doing that right. I guess I'll try restarting or something.

Member Avatar
gzero14
Newbie Poster
13 posts since Jul 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Eh where's the edit button...how'd I edit it last time ._.;;

Anyways the restart did it. Though I wonder why the java command would work while javac wouldn't...*shrug*

Member Avatar
server_crash
Postaholic
2,106 posts since Jun 2004
Reputation Points: 64 [?]
Q&As Helped to Solve: 29 [?]
Skill Endorsements: 28 [?]
 
0
 

No, it has to be one of your path variables. The reason it doesn't work is because it cannot find javac.


Anyways, I'm thinking it could be your Path variable(not the classpath since it looks correct). Please post your PATH variable. You might be pointing it to the jdk directory when you should be pointing it to the jre directory.


The path variable is located at the same place the classpath is, or you can type this at the command prompt:

echo %PATH%

Member Avatar
server_crash
Postaholic
2,106 posts since Jun 2004
Reputation Points: 64 [?]
Q&As Helped to Solve: 29 [?]
Skill Endorsements: 28 [?]
 
0
 

Eh where's the edit button...how'd I edit it last time ._.;;

Anyways the restart did it. Though I wonder why the java command would work while javac wouldn't...*shrug*

Sorry, looks like we posted at the same time. Some times you do need to restart your computer for changes to take affect. The java command just invokes the JRE, so no problem should arise there. Anyways, glad you got it fixed.

Member Avatar
gzero14
Newbie Poster
13 posts since Jul 2005
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for your help :].

Member Avatar
kostasbet
Newbie Poster
2 posts since Dec 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

The reason why the javac doesn't work indicates that you are not pointing to the right path for the compiler. I had exactly the same problem because the path of the environmental variable was pointing to the Run time Engine instead of the Development kit. You need to change it from the JRE to the JDK folder.

Member Avatar
masijade
Industrious Poster
4,165 posts since Feb 2006
Reputation Points: 1,351 [?]
Q&As Helped to Solve: 510 [?]
Skill Endorsements: 22 [?]
Team Colleague
Featured
 
0
 

I'm sorry, but you do realise that this thread was over two years dead, until you rejuvinated it, right?

Member Avatar
kostasbet
Newbie Poster
2 posts since Dec 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
1
 

i realise that the the thread is old but it is the first result that comes up if you google 'javac doesn't work' so i thought that it might be useful for other people if there is actually a resolution to this thread. apologies if i caused any inconvenience but even late replies are appreciated in the forums of the company i work for

Member Avatar
masijade
Industrious Poster
4,165 posts since Feb 2006
Reputation Points: 1,351 [?]
Q&As Helped to Solve: 510 [?]
Skill Endorsements: 22 [?]
Team Colleague
Featured
 
0
 

But there was a resolution. did you see posts 8-10.

In post 8 a restart, in post 9 "set the PATH", in post 10 explained that the restart simply let the change (to the path that the installation itself did) take hold globally (she/he was probably using a cmd shell that had been open for a while).

So, as you can see, the answer was already given. Please do not resurrect old threads unless absolutely necessary (which it almost never is).

Member Avatar
narayanabhilash
Newbie Poster
6 posts since Dec 2007
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi,
You havn'y set the path for the bin folder.
go to Environment variables & add the path "C:\Program Files\Java\jdk1.6.0_03\bin" into existing Key PATH.

It will work properly.

Until you will get "Unrecognized Command javac"

Enjoy.

Member Avatar
masijade
Industrious Poster
4,165 posts since Feb 2006
Reputation Points: 1,351 [?]
Q&As Helped to Solve: 510 [?]
Skill Endorsements: 22 [?]
Team Colleague
Featured
 
-1
 

Another person who doesn't bother to actually read the thread.

Member Avatar
tartaruss
Newbie Poster
1 post since Feb 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

i have the same problem. have gone to environmental variables and made a new path with the javac thing but javac still doesn't work, saying "javac not recognized as an internal or external command", while same as gzero14, java command works fine.

Member Avatar
zeroliken
Nearly a Posting Virtuoso
1,222 posts since Nov 2011
Reputation Points: 79 [?]
Q&As Helped to Solve: 216 [?]
Skill Endorsements: 15 [?]
 
0
 

^what masijade said several years ago :icon_rolleyes:

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article