Starting Java

1,319 views
1,273 views

Published on

Guide how to set up your desktop/notebook to be able compiling and running java code.

Compiled from various sources & my own experience.

Hope it helps u guys starting Java :D

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,319
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Starting Java

  1. 1. Starting Java by Fiona AngelinaTo start learning Java, youll need to prepare several stuff. One of the most important thingis to prepare the IDE. You can use either Netbeans, Eclipse, or EditPlus.EditPlus is just WAYYY better than NetBeans or Eclipse for smaller program (waiting forNetbeans to load is just a pain in the ass, moreover it will produce lots of unnecessary file).To set up EditPlus3 to be able to compile and run Java code, here is the tutorial.There are also other stuff besides setting up Edit Plus 3.SETTING UP EDIT PLUS31. Download the EditPlus3 & JDK (Java Development Kit)Download EditPlus3, and install your EditPlus3. Besides EditPlus3, you also have todownload the JDK from Sun website, to be able to compile Java code.JDK Download LINK:http://www.oracle.com/technetwork/java/javase/downloads/index.htmlGo to the above link. Find Java SE 6 Update 23, click the button DOWNLOAD JDK. Starting Java by Fiona Angelina 1
  2. 2. 2. Setting the Edit PlusOpen your EditPlus3. Go to Tools > Configure User Tools. A new window Preferences willappear. Choose Add Tool > Program.Edit the fields into like this (for compiling): Starting Java by Fiona AngelinaIn the command field, you have to check the location of your javac.exe in the WindowsExplorer. In my case, the path is: C:Program FilesJavajdk1.6.0_23binjavac.exe. Tick boththe Capture output and Save open files.To create new program for running, choose Add Tool. Fill the fields again into like this: 2
  3. 3. In the command field, you have to check the location of your java.exe in the WindowsExplorer. In my case, the path is: C:Program FilesJavajdk1.6.0_23binjava.exe. Tick onlythe Save open files. Do not tick Capture output, so the command prompt window willappear.Press OK to save your settings.3. TestingTo test, create new Java file by choosing File > New > Java. Give name to the class so thecode becomes like this: Starting Java by Fiona AngelinaTry compiling using CTRL + 1. Save the file with the exact name just like the class name. Inthis case, the class name is HelloWorld, therefore you have to save it with nameHelloWorld.java. 3
  4. 4. Try running using CTRL + 2. New window will appear printing the text "Hello World!" intothe screen.Now your EditPlus3 can be used for compiling and running Java code.OTHERSWell, like I have said before, EditPlus is not the end of the World. You can use otherapplication such as Eclipse, or NetBeans, or without any application (just a text editor andcommand prompt). But remember to always install the JDK first.COMPILING AND RUNNING WITH COMMAND PROMPTFirst you have to set up your Environment Variables. Do this by right-click on Computer. Goto Advanced System Settings > Environment Variables . Starting Java by Fiona AngelinaClick PATH, and choose Edit. Paste your javac directory into the front of Variable value,ended with ";". DO NOT delete the other path. Just paste it.Example: C:Program FilesJavajdk1.6.0_23bin;.Press OK to save all the settings.Create your .java file, and open your command prompt.To compile: javac [filename]To run: java [filename without extension] 4
  5. 5. For example if your filename is HelloWorld, then to compile: javac HelloWorld.java, and torun java HelloWorld.USING ECLIPSEDownload ECLIPSE here:http://www.eclipse.org/downloads/Download either ECLIPSE IDE For Java Developers or ECLIPSE Classic 3.6.1. Extract thecompressed file, into the path you want to install the Eclipse. No need to install anything. Torun just double click on the Eclipse.EXEUSING NETBEANS Starting Java by Fiona AngelinaDownload NETBEANS here: http://netbeans.org/downloads/index.html 5
  6. 6. Java SE should be enough (again, if Im not mistaken). Other kind of Java would be fine too:Java FX or Java. If you want your NetBeans to be not only able to compile & run Java, butalso C/C++/PHP, you can download All.USING MACWell, I cant help you much with it since I am primarily Windows user. The easiest one wouldprobably be just install NetBeans for MAC cause Netbeans will take care all of the stuff. Theother one, is to install Windows in your MAC, and install EditPlus3/Eclipse/NetBeans forWindows.Netbeans for MAC LINK (not-so-sure which kind of NetBeans is this):http://netbeans.en.softonic.com/macHope it helps.Have fun Starting Java by Fiona Angelina 6

×