User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 403,513 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,017 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 42822 | Replies: 18
Reply
Join Date: May 2006
Posts: 17
Reputation: jaden403 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
jaden403 jaden403 is offline Offline
Newbie Poster

Re: Compile Java

  #11  
Oct 20th, 2006
For what it's worth, go to http://www.jgrasp.org and download their very easy to use GUI-based editor. There are not a lot of bells and whistles, but it is free and is a decent enough compiler.

Additionally, the actual Java compiler should be in a directory called jdk1.5.0_08\bin. This is providing that you have JDK installed correctly.

You are getting this error message:

'javac' is not recognized as an internal or external command,
operable program or batch file.

because the compiler is not in the directory that you are trying to run it from. Try this:

cd c:\java\jdk1.5.0_08\bin

c:\java\jdk1.5.0_08\bin>javac HelloWorldApp.java

c:\java\jdk1.5.0_08\bin>java HelloWorldApp

I followed the above steps and got the proper output:

Hello World!
Last edited by jaden403 : Oct 20th, 2006 at 10:35 pm. Reason: additional comments added
Reply With Quote  
Join Date: Oct 2006
Posts: 5
Reputation: Barbank is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Barbank Barbank is offline Offline
Newbie Poster

Re: Compile Java

  #12  
Oct 20th, 2006
I've installed just about every link I can find off of JavaSun's website and JGrasp still says I havent installed the right environment.
Reply With Quote  
Join Date: Sep 2006
Posts: 9
Reputation: fastmike is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fastmike fastmike is offline Offline
Newbie Poster

Solution Re: Compile Java

  #13  
Oct 22nd, 2006
ok THIS WILL WORK FOR SURE.
delete everything and go to this download page and download the j2sdk1.4.2_12 version for windows.
http://java.sun.com/j2se/1.4.2/download.html
Then download this version.
J2SE v 1.4.2_12 SDK includes the JVM technologyhttp://java.sun.com/images/pixel.gifThe J2SE Software Development Kit (SDK) supports creating J2SE applications. More info...http://java.sun.com/images/pixel.gifDownload J2SE SDKhttp://java.sun.com/images/pixel.gifInstallation Instructions ReadMe ReleaseNotes
Sun License Third Party Licenses

i am assuming you know how to install anyways after installing you need to know where your j2sdk1.4.2_12 folder is. just for instance lets assume you have it in c drive. go to start and then run command prompt window. enter cmd. you should have a path something like this
c:\documents and settings\chris
well do this first
cd..
after that you will have c:\\documents and settings
well do the same thing one last time so then you are in your c:\
cd..
now you will have the screen something like this
C:\
i am assuming your j2sdk folder is in c drive so you will do this next
cd j2sdk1.4.2_12 (then press enter)
now you will see your command prompt like this
c:\j2sdk1.4.2_12
then just type one last command.
cd bin
now your command prompt looks like this
c:\j2sdk1.4.2_12\bin
Thats it BOYyYyyyYyy You got it. The next thing you need to do is type your code in a notepad and make sure MAKE SURE YOU SAVE IT IN THE BIN FOLDER WHICH IS IN J2SDK1.4.2_12 and save it as a .java file e.g (HelloWorldApp.java) in the bin folder.
Now go to your command prompt i hope it is still in bin directory
type this
javac HelloWorldApp.java
no errors HURRAY !!!!
then type java HelloWorldApp
Have fun BoYyYyyYy
Reply With Quote  
Join Date: Jul 2007
Posts: 30
Reputation: grii_19 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
grii_19 grii_19 is offline Offline
Light Poster

Re: Compile Java

  #14  
Jul 31st, 2007
hey fastmike ,
thx it helped me a lot

but there r 2 things i am yet concerned to ask

1) can i run this programs when i save them in sum diff folder ?
there must be sumthing which enables the path where javac
can b enabled
eg in f:\girish\example.java

can i run this program there and not just in bin folder
c:\j2sdk...\bin

2) whenever i tried typing cd j2sdk1.4.2_13
it said invalid folder name
so i renamed it to java2_13
will it harm other programs or jre ?
do i need to make any changes sumwhere also ?

and thx again it helped but wish i could save my programs
in sum oter files
Reply With Quote  
Join Date: Dec 2004
Location: London or Slovakia
Posts: 2,249
Reputation: peter_budo is a jewel in the rough peter_budo is a jewel in the rough peter_budo is a jewel in the rough 
Rep Power: 10
Solved Threads: 272
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Compile Java

  #15  
Jul 31st, 2007
grii_19 do not use this approach, this is considered bad practice to save anything into Java instalation folder. Please follow the link to the tutorial which I gave it to you in another post
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

If we helped you to solve your problem, answered your question please mark your post as SOLVED.
Reply With Quote  
Join Date: Feb 2006
Posts: 1,383
Reputation: masijade is a jewel in the rough masijade is a jewel in the rough masijade is a jewel in the rough masijade is a jewel in the rough 
Rep Power: 8
Solved Threads: 120
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: Compile Java

  #16  
Aug 1st, 2007
Oh man, the deaf leading the blind.

I have no idea where this "save it to the bin folder" stuff got started, but here ye, what rubbish.

I know, I know, now you're going to come back with, but it works and its better than nothing, so whats wrong with it.

Well, if your foot itches you can cut it off, it works, and it's better than nothing, but there is still definately something wrong with it.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Jul 2007
Posts: 30
Reputation: grii_19 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
grii_19 grii_19 is offline Offline
Light Poster

Re: Compile Java

  #17  
Aug 1st, 2007
hey peter
thx ..... yep i followed ur advice from other forum
and itz working properly now
thankz bro .....

blind leading the deaf ??????????????????????
didnt got wht it meant but no longer saving the files in
bin folder ......
so thank you
Reply With Quote  
Join Date: Feb 2006
Posts: 1,383
Reputation: masijade is a jewel in the rough masijade is a jewel in the rough masijade is a jewel in the rough masijade is a jewel in the rough 
Rep Power: 8
Solved Threads: 120
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Virtuoso

Re: Compile Java

  #18  
Aug 1st, 2007
The blind leading the deaf is just a "cute" way of saying that the help being given (at least by some) is bound to cause a lot of confusion, misdirection, antics, and probably dangers. Not that they are intended, but they are going to happen (and it will usually by comical).
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote  
Join Date: Aug 2007
Location: South Africa
Posts: 2
Reputation: lordkwena is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
lordkwena lordkwena is offline Offline
Newbie Poster

Re: Compile Java

  #19  
Aug 1st, 2007
what you need to do is: you need to add the path, to do that, you right click my computer icon on the desktop, you then go to properties, from there you go to advanced, from advanced you go to Environmental variables, under System variables (in blue color), you double click path. at the end of you path you put a sermi-colon(, the you add your path, e.g if you using java 6(or jdk 6), you type in: C:\Program Files\Java\jdk1.6.0\bin; then click on OK, OK again, Apply, OK, then go to command, if you class is in c: you need to move to the c drive, this is how it is supposed to look: c:\> then type javac HelloWorldApp.java

Hope this will help
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 12:54 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC