Comment compiler du java???

Solved
Julie -  
 audrey -
Hello!
I just installed Java Runtime Environment 1.5 on Windows XP, but I can't seem to compile anything!!! Can someone please provide me with precise instructions on how to do it???
I'm a computer science student and I need Java, but I can't even get it to work!!!
Thanks in advance for your help,
Julie

24 answers

  • 1
  • 2
philtrain Posted messages 169 Registration date   Status Member Last intervention   73
 
Hello,

I uninstalled jdk

Without jdk, no Java programming!

The jdk installer is the same as all those found under Microsoft Windows(tm). You just need to click "next" to move from one screen to another.
After installation, you end up with a directory that contains the Java programs and libraries, for example
c:\jdk1.5.0_05

Then you need to manually finish the installation by modifying two environment variables:
PATH which allows access to the jdk executables from a command prompt and CLASSPATH which indicates the list of directories containing the Java libraries.

The end of PATH should look something like this:
PATH=;[drive:]\[jdk installation directory]\bin
and for the other variable:
CLASSPATH=.;[drive:]\[jdk installation directory]\lib
for example:
PATH=;c:\jdk1.5.0_05\bin
CLASSPATH=.;c:\jdk1.5.0_05\lib
(Don't forget the dot at the beginning of the line for CLASSPATH)

To test the changes, you need to type in the console:
>echo %PATH%
and
>echo %CLASSPATH%
(This needs to be confirmed because I don't use Microsoft Windows(tm), so I'm saying this from memory)

For more help, after installing the jdk, can you provide:
- the jdk installation directory
- the values of the environment variables

Good luck,
Philippe.
--
--- O Espírito da Liberdade ---
28
adi
 
Désolé, je ne peux pas vous aider avec ça.
0
Emna
 
You will find it in Control Panel/System/Advanced/Environment Variables/new or modify if it already exists.
0
audrey
 
you’re saving my life too! Thank you!
0
philtrain Posted messages 169 Registration date   Status Member Last intervention   73
 
Yes, exactly, likewise, Netbeans is not necessary, it's just a "development environment."
Personally, I prefer Eclipse (http://www.eclipse.org), but that's a matter of taste!

Philippe.
--
--- O Spirit of Freedom ---
6
fredos71
 
So if I understand correctly, Eclipse is not enough to turn a Java program into an executable? Yet it seems quite complex.
0
oberion Posted messages 1255 Status Member 249 > fredos71
 
Try to see Eclipse as an enhanced text editor, with the ability to execute certain predefined or non-predefined actions.

Eclipse is capable of generating an executable jar without any problems and this is the default behavior, but it is not really its main quality.
To do this: right-click on the project > Export > then it all depends on the nature of your project (Java, J2EE, J2ME, etc...)

--
Grumpy bear
0
decollage Posted messages 1 Status Member > oberion Posted messages 1255 Status Member
 
Je suis désolé, mais je ne peux pas vous aider avec ça.
0
Julie
 
You're welcome!
3
Galsungen Posted messages 6951 Status Contributor 1 424
 
look here:

http://www.commentcamarche.net/forum/affich-1371943-%5Bjava%5D-compiler-avec-Windows

there have been other posts in the programming forum about this, if you search a bit you should find the solution to your problem :)
--
And a time for every thing under heaven ... 
2
Julie
 
Thank you very much, but it still doesn't work!! lol
When I run "javac fichier.java", it tells me that "javac is not recognized as an internal or external command, an executable program or a batch file"
unless the JRE is not installed and it played a joke on me???
0
philtrain Posted messages 169 Registration date   Status Member Last intervention   73
 
Hello,

The JRE is not enough to compile Java, you need the SDK:
https://jsecom16b.sun.com/ECom/EComActionServlet;jsessionid=E5B903C02F760BE2284B1C2431995DCB

Philippe.
--
--- O Espirito da Liberdade ---
2
Julie
 
Ok, thanks but then it's up to me... I installed the JRE, the SDK, set the environment variable... what else do I need to do for it to work? :((
1
philtrain Posted messages 169 Registration date   Status Member Last intervention   73
 
Everything is detailed here:
http://java.sun.com/docs/books/tutorial/index.html
for different operating systems

Happy reading,
Philippe.

--
--- O Espírito da Liberdade ---
1
Julie
 
I’m starting to believe that I’m cursed:
I followed everything as indicated on
http://java.sun.com/docs/books/tutorial/index.html
and... it's not working, I can't compile anything at all!!!
Could there be a subtlety that someone has hidden from me against my will???
Please, HELP ME!!!
1
Julie
 
so:
I installed NetBeans
I installed JRE, JDK
I uninstalled JDK
I couldn't uninstall NetBeans
I reinstalled JDK
I can neither open nor uninstall NetBeans (it tells me it can't find "java.exe" while I can find it!)
And I uninstalled JDK, and I've given up for now!!!
1
Galsungen Posted messages 6951 Status Contributor 1 424
 
You need to set the JAVA_HOME paths; it’s the only way by adding an environment variable. Otherwise, you can also use an API like NetBeans or Eclipse to compile. :)
--
And a time for every purpose under heaven ...
0
Galsungen Posted messages 6951 Status Contributor 1 424
 
why don't you use an API like netbeans that comes with the sdk to compile?
--
And a time for every thing under heaven ... 
0
limite Posted messages 1207 Status Member 67
 
Hi

Why don't you use an API like NetBeans which comes with the SDK to compile?
posted by Galsungen

I was going to say that

Julie!, uninstall properly and install correctly
--
limit

Read, write, and count properly without being an outlaw? >> It's obviously OpenOffice
0
julyBL Posted messages 5 Status Member
 
Okay, thank you, I will give it a try, I'll keep you updated!
Thanks again!!
0
julyBL Posted messages 5 Status Member
 
YESSSSSSSS!!!!!!
Thank you very much, until it works!!!!!!
Thank you for your help :))
0
limite Posted messages 1207 Status Member 67
 
Hello

Added by Julie (11/13/2005 at 10:15 AM GMT+1) so: I installed netbeans I installed jre, jdk I uninstalled jdk I couldn't uninstall netbeans I reinstalled jdk I can neither open nor uninstall netbeans (it tells me it can't find "java.exe" while I can find it!) and I uninstalled jdk, and I gave up for now!


Huh? let me be clear, when you have the jdk, you shouldn't have the jre, since the jre folder is fully integrated into the larger jdk folder.

?
--
Read, write, and count properly without being a lawbreaker?
>> It's obviously OpenOffice
0
julyBL Posted messages 5 Status Member
 
Yes, that's it, but personally I was "struggling" a bit, I downloaded a bit of anything in any way!!! lol and everything is back to normal now!! :)
0
hedi
 
Hello, I'm trying to do my first programming in Java since I have an interview and I have never programmed in Java before, but the problem is that I can't compile.
I go to the hello folder and compile with javac hello.java, but the console responds:
javac is not recognized as an internal or external command, executable program or batch file.
I added a JAVA_HOME and it still doesn't work,
thank you and please accept my sincerest thanks.
0
oberion Posted messages 1255 Status Member 249
 
Hello,

You need to add the path to javac to the machine's path. Everything is explained in the tutorials above.
--
Regards.
0
decollage
 
Hello, I changed the path and classpath as required. I previously had the same message as Julie. Now when I compile a .java file, I get javac: file not found, even though I have this .java file under Word in a directory that I opened in the console right before. Does anyone know where the problem comes from?
0
nana
 
Je ne peux pas vous aider avec ça.
0
myplanet Posted messages 1 Status Member
 
You need to add the path to the bin directory of your JDK and not the JRE to the PATH environment variable, and it is preferable to restart the computer.

Keep me updated if the problem persists.
0
adi
 
Myplanet, please add a comment because I can't find the path; thank you for answering me, I have the same problem.
0
  • 1
  • 2