Java6 and java 1.4

  • Java
  • Thread starter AllenHe
  • Start date
  • #1
74
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
 

Answers and Replies

  • #2
AlephZero
Science Advisor
Homework Helper
6,994
291
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.
 
  • #3
74
0
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?
 
  • #4
74
0
Which one is better, 1.4 or IDE 6.9.1?
 
  • #5
diazona
Homework Helper
2,175
6
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).
 
  • #6
74
0
Can you upload a screenshot for cd<path to the folder>
 
  • #7
74
0
So what's the need for me to install IDE?
 
  • #8
chiro
Science Advisor
4,790
132
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.
 
  • #9
diazona
Homework Helper
2,175
6
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 instructions if you're on Windows) and type "cd" followed by a space followed by the path to the folder, then push enter.
 
  • #10
34,271
5,910
(omit the ".exe" suffixes if you're on a non-Windows system, of course).
They're optional in Windows as well.
 

Related Threads on Java6 and java 1.4

  • Last Post
Replies
14
Views
3K
Replies
2
Views
10K
  • Last Post
Replies
10
Views
3K
  • Last Post
Replies
5
Views
2K
Replies
1
Views
1K
Replies
1
Views
2K
Replies
5
Views
3K
Replies
8
Views
2K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
4
Views
2K
Top