...

View Full Version : Intro to Java



binaryWeapon
02-12-2008, 03: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.

_Aerospace_Eng_
02-12-2008, 05: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.

http://www.javacoffeebreak.com/tutorials/gettingstarted/index.html

binaryWeapon
02-12-2008, 02: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?

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

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

_Aerospace_Eng_
02-13-2008, 03: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.

brad211987
02-13-2008, 03: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.

ley
02-13-2008, 06:21 PM
Try TextPad.

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

playwiz
02-13-2008, 09: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:

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum