My Java Secrets

by Jevin On 7:52 PM

A while back one of my classmate made a post about Netbeans v/s Eclipse. Both are IDEs for developing java programs. Well the thing is, unless in a desperate situation, I don't use these IDEs. Why? I have personal reasons and I don't wish to divulge them. LOL

Okay so many of you must be wondering what the fuck I use.. Well I use the Java Compiler and the Java Executer (not sure its the way its called). I also use notepad to write the source code. Now all this is beautiful, but how do I do this some will ask.

To compile the source code, I will use a file named javac.exe. You can find it in c:\program files/java/jdk1.6.0_01/bin/. So now that I have the path of the java compiler, I can compile it using the console. What I have to do, is open a console and get to the directory of the source code and type:

"c:\program files/java/jdk1.6.0_01/bin/javac.exe" Source.java

You should
include the double quotes as well. Now that we got our program compiled, its time to run it and to run, we need a file named java.exe found in the same directory as javac.exe. Only this time, we will pass the name of the .class file as argument. So there goes:

"c:\program files/java/jdk1.6.0_01/bin/java.exe" Source

"Great it runs, the guy was not talking shit" you must be saying. LOL Notice that I didnt use the .class extension. Anyway since you will have to be running and compiling the file like a billion times, do like me, use batch files. I use 2 batch files: one for compiling (compile.bat) and another to run named (run.bat).

The compile batch file is simple. Here is the code:
echo off cls
"c:\program files/java/jdk1.6.0_01/bin/javac.exe" Source.java
pause

Just open notepad paste the code there and save as "compile.bat". Yes use the double quotes to prevent your file from being saved as compile.bat.txt

The run.bat should look like this:
echo off
:loop
cls
"c:\program files/java/jdk1.6.0_01/bin/java.exe" Source
pause
goto :loop

Just paste on notepad and save as "run.bat" and its ready to roll. I know that having an IDE doing this is easier. In fact, I learnt to do this last year, because our lecturer told us to use Eclipse but I never had the chance to use Eclipse in the labs. Eclipse was installed on very few computers and finding a computer with Eclipse and Internet connection was possible if you were the first one to enter the lab. LOL. So I had to do my own stuff. I even use this to present my labsheets. And guess what, I only need a computer with an Internet Connection in the Labs.

Fortunately JDK is installed on all computers. Anyway, hope you enjoyed this.

12 Response to 'My Java Secrets'

Post a Comment

  1. morinn Said,

    hehe, photo la zoli! :D

    mem si c t du grec pou moi, hmmmm, ek mo pane compren gran choz! :$

    lol...

    mai kan mo guet sa photo la mo penser "my thoughts exactly"

     

  2. Jevin Said,

    LOL wai n ban zafer mone fer lor paint sa. Paint ftw LOL

     

  3. ¥@$# Said,

    Donc c par ene concours de circonstances ki to pa servi IDE...

    Hey los to ti kav mette link Netbeans v/s Eclipse la ta... To ti pou gagne visitors depi mo post oci lerla...

     

  4. Unknown Said,

    o fait mo si mo ti p fer pareil. compile la mo ti p kav ekire 1 .bat pou compile tou *.java mais pou run pa kav non? parceki to bizin run helloworld sans .class. alor to pa kav java *.class...... non?

     

  5. Unknown Said,

    wer compile.bat compile all .java files dan folder la.... pa bizin al modifier .bat la a sak foi

     

  6. $€|v3n Said,

    yay, way to go man, hope this helps some ppl around :p

    This is the way things should be :)
    nice, clean, light and efficient :p

    normalement, pas necessaire servi bat, to bizin add javac dans to environment variable(control panel>system>Advanced>Environment Variables), then you can just simply type javac thefile.java, javaw thefile )

    Mais seki compte c, you did it using things you know, yuuhuuu, :p out of the box :p, that would put you in my list of "real computer dudez" then :p.

    interesting article, and well, the others needs to read it to save themselves time (and RAM :p).

    Anywayz, another thing i noted, your Paint drawings are like mine, hahahahaha!

    Good job

    Cya l8r.
    +S3|v3n

     

  7. Jevin Said,

    LOL merci selven. Wer mo n boss lor paint mwa. LOL Dpi zenfan mo ladan mwa. O fai mne nek fer n trik random com dab.

    Wai kervin donc c ki to bizin fer c:

    "c:\....\javac.exe" *.java

     

  8. Unknown Said,

    echo off
    cls
    "c:\program files\java\jdk1.6.0_02\bin\javac.exe" *.java
    "c:\program files\java\jdk1.6.0_02\bin\javac.exe" *.java
    pause


    li compile tou files nah?? *.java, donc to pa bizin modifier .bat file la a sak foi...?? pou run .class kuma pou fer?

     

  9. Jevin Said,

    Kervin. Aprer mo explik twa. LOL seye compren ban files men send twa la touzour.

     

  10. Anonymous Said,

    As your Java programs become more complex, you will soon hit the limitations of .BAT files to compile them. Then, it will be time for you to graduate to Ant (http://ant.apache.org).

    --Eddy

     

  11. m0rph Said,

    bon en bref ... mank 1 string ladan!

    ok mo expliker : c ene joke ki mo abitier fer ar bn java geeks ki mo coner! pa si drole ke sa eh?

     

  12. Anonymous Said,

    Jevin, to drawing la ena some hidden meanings or information behind?

     

 
Template designed by Jevin | Based on Minima template by Douglas Bowman xv7gwc2arb