Troubleshooting Java6 & Java 1.4 in Netbeans 6.9.1

  • Java
  • Thread starter AllenHe
  • Start date
  • Tags
    Java
In summary, 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.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.
  • #1
AllenHe
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
 
Technology news on Phys.org
  • #2
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
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
Which one is better, 1.4 or IDE 6.9.1?
 
  • #5
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
Can you upload a screenshot for cd<path to the folder>
 
  • #7
So what's the need for me to install IDE?
 
  • #8
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.
 
  • #9
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.
 

Related to Troubleshooting Java6 & Java 1.4 in Netbeans 6.9.1

1. What is the difference between Java6 and Java 1.4?

Java6 and Java 1.4 are different versions of the Java programming language. Java6 is a newer version with more advanced features and improvements, while Java 1.4 is an older version that may not support some of the newer functionalities.

2. Why is there a need to troubleshoot Java6 and Java 1.4 in Netbeans 6.9.1?

Netbeans 6.9.1 is an integrated development environment (IDE) used for Java programming. It supports multiple versions of Java, including Java6 and Java 1.4. However, since these versions have different features and functionalities, troubleshooting may be necessary to ensure that the code runs properly on both versions.

3. How can I troubleshoot Java6 and Java 1.4 in Netbeans 6.9.1?

To troubleshoot Java6 and Java 1.4 in Netbeans 6.9.1, you can use the "Project Properties" feature to set the source and target compatibility to the respective Java versions. You can also use the "Run" menu to select the specific version you want to run the code on.

4. What are some common issues when troubleshooting Java6 and Java 1.4 in Netbeans 6.9.1?

Some common issues when troubleshooting Java6 and Java 1.4 in Netbeans 6.9.1 include incompatible code or libraries, missing dependencies, and differences in syntax or behavior between the two versions. It is important to carefully check for these issues and make necessary changes to ensure compatibility.

5. Is it possible to develop code that is compatible with both Java6 and Java 1.4 in Netbeans 6.9.1?

Yes, it is possible to develop code that can run on both Java6 and Java 1.4 in Netbeans 6.9.1. However, it may require some extra effort and troubleshooting to ensure compatibility. It is important to carefully test the code on both versions before deploying it to ensure it runs smoothly on both platforms.

Back
Top