Java Troubleshooting Java6 & Java 1.4 in Netbeans 6.9.1

  • Thread starter Thread starter AllenHe
  • Start date Start date
  • Tags Tags
    Java
AI Thread Summary
Errors encountered in NetBeans IDE 6.9.1 while running a simple "Hello World" program may stem from confusion over line numbers in tutorials, which should not be included in the code. The differences between Java versions, particularly Java 1.4 and later versions, do not affect the basic functionality of the "Hello World" program. NetBeans serves as an integrated development environment that simplifies project management and compilation, but it is not strictly necessary for writing Java code. Beginners are encouraged to write and compile Java programs using a basic text editor and command prompt for a clearer understanding of the process. Ultimately, while using an IDE can streamline development, it can also complicate simple tasks for newcomers.
AllenHe
Messages
74
Reaction score
0
I have Netbeans IDE 6.9.1 installed on my computer,and I was trying to enter the following code in a new project:

01 public class Hello
02 {
03 // 是程序的起点,所有程序由此开始运行
04 public static void main(String args[])
05 {
06 // 此语句表示向屏幕上打印"Hello World !"字符串
07 System.out.println("Hello World !");
08 }
09 }
(You can ignore the Chinese characters.Im only interested in 01,04,and 07)
And it gave me so many errors,I don't know why.The program used in the tutorial was Java2 Platform Standard Edition, Version 1.4.Is it because of different versions of Java, or because I didn't start a new project? Cause I clicked create new project, and selected Java application, and it was not empty when created.
Thanks
 
Technology news on Phys.org
It would be easier to answer the question if you tell us what the error messages said.

Apologies if this is a dumb suggestion, but I'm guessing you are a complete beginner. The line numbers 01, 02, etc are not part of the Java program, they are just printed in the tutorials so the explanations can reference a particular line. If you typed the line numbers in, you would certainly get lots of "crazy" errors.

There are lots of differences between Java 1.4 (which is obsolete now) and the latest version, but your "hello world" program should work in any version.
 
Yea ,I am a complete beginner.I didn't type in the numbers on the left.But can you tell me how to create a new project in Netbeans IDE 6.9.1? Or do you have any tutorials for this program?
 
Which one is better, 1.4 or IDE 6.9.1?
 
Java 1.4 and Netbeans 6.9.1 are completely different things - it makes no sense to ask which is better.

"Java" itself is just a programming language; it defines the grammar and syntax that you are allowed to use in your source code. The "Java 2 Platform" is the set of programs that you need to compile and run Java source code; these have names like "java", "javac", etc. (or "java.exe", "javac.exe", "javaw.exe" if you're on Windows).

On the other hand, Netbeans is an integrated development environment, which is a program that you can use to write the source code. It has a lot of features, but basically it's just a text editor. If you wanted to, you could ignore Netbeans entirely and just use Notepad (or any other text editor) to write Java programs.

In fact, I'd suggest doing that in this example, so that you have a sense of what it really takes to write a Java program. Open your preferred text editor (Notepad or something), enter the source code for your "Hello World" program (the lines you pasted in your first post), and save the file as "Hello.java". Note the full path to the folder you saved it in. Then open up a command prompt, change to the folder where you saved the file
Code:
cd <path to the folder>
and compile it with the command
Code:
javac.exe Hello.java
Then you can run the program with the command
Code:
java.exe Hello
(omit the ".exe" suffixes if you're on a non-Windows system, of course).
 
Can you upload a screenshot for cd<path to the folder>
 
So what's the need for me to install IDE?
 
AllenHe said:
So what's the need for me to install IDE?

It automates and integrates the different tools for you.

The IDE will make the project file and handle project settings for you, it will compile for you, and create the java binary for you as well, to execute under the java VM.

It's just a GUI frontend for Java development, where the GUI environment integrates, code creation (text editor), project management, and the development process (compilation, linking and so on) is integrated together in a way that gives you your IDE.
 
AllenHe said:
So what's the need for me to install IDE?
You don't need to.

But if you do, it makes certain tasks easier, as explained by chiro. On the other hand, it also makes things like just creating a simple program more complicated.

By the way, why do you need a screenshot? Just open the command prompt (see http://www.computerhope.com/issues/chdos.htm if you're on Windows) and type "cd" followed by a space followed by the path to the folder, then push enter.
 
  • #10
diazona said:
(omit the ".exe" suffixes if you're on a non-Windows system, of course).
They're optional in Windows as well.
 
Back
Top