View Full Version : Intro to Java

02-12-2008, 04:19 AM
Alright, I've had some trouble with trying to learn java in the past, mainly installing and using the tools that Sun Micro provides. I have found some pretty good tutorials, although if anyone thinks they know a phenomenal one feel free to mention. The main thing I'm looking for is a good, straight java compiler. I don't need a fancy-shmancy IDE, just a simple debugger/compiler.

I just need to be pointed in the right direction; I have big plans for java and my webpage.

02-12-2008, 06:06 AM
I prefer Eclipse for developing java. You will need the JDK. Do a search on how to setup the environmental variables for java. After doing that successfully you can run java from the command line or use eclipse. Eclipse is good for debugging. Good tutorial here on getting java setup on your system.


02-12-2008, 03:19 PM
Thank you, it appears to be just what I've been looking for. However, I can't seem to debug or run any programs. I have my code:

public class Helloworld
public static void main(String[] args)
System.out.println("Hello World!");

in a .java file. I try to run it and I get an error

The selection could not be launched, and there are no recent launches.
Do you happen to know what's wrong?

02-12-2008, 05:30 PM
how did you run the program? Alt+Shift+X, J ?

02-13-2008, 12:55 AM
CTRL-F11, (menu bar) > Run > Run
Is that right? I mean, should I be doing it a different way?

02-13-2008, 04:12 AM
What program are you using to run the file? Did you setup your environmental variables? Have you tried using the command line to verify that everything is working properly. READ the whole tutorial, not just bits and pieces.

02-13-2008, 04:59 PM
In Eclipse, right click on your .java file in the navigation window and choose:
"run as" --> "java application"

This is the same as the ALT+SHIFT+X, J keyboard shortcut.

If you want to test it on the command line, after ensuring that you have Java installed and configured correctly you can simply use the compiler from the command line.

First, on the command line, navigate to the directory where you have your .java file.
Then type "javac MyFile.java" without the quotes.
Then type "java MyFile" again without quotes.

The javac command compiles the .java file into a .class file, and the java command runs the .class file.

02-13-2008, 07:21 PM
Try TextPad.

Oh make sure you are saving your .java file exactly the same as your class name

02-13-2008, 10:57 PM
Starting out with Java, I didn't like Eclipse much. I prefered Jcreator Pro and later on moved on to NetBeans. I still use Jcreator Pro occasionally.

-my first post! :thumbsup:

02-14-2008, 04:54 PM
I don't need a fancy-shmancy IDE
well if you dont want a "fancy-shmancy IDE" go for notepad, lol.