English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

After downloading the latest Java SDK 1.4.2 & API Documentation from sun.java.com, I am having a little trouble on how to open Java language. I have got "Java Web Start" icon on the desktop. Once I click on it, I get the "Java Web Start Application Manager" window while I am online. I also get 4 applications like "Draw 4 App". I am very eager to start coding my first Java program. While offline, where to code, how to compile and run in the end? Please write me in detail.

2006-07-16 07:20:16 · 6 answers · asked by CyberRider 1 in Computers & Internet Programming & Design

6 answers

Unfortunately, the other answerer is correct in saying java 1.5 is the latest version.

I am assuming you have followed the installation instructions and are able to do the following:

(1) open a command line window, if in MS Windows this is Command Prompt, or the old MS DOS Prompt.

(2) type 'java' without the quotes at the command prompt.

(2.1) if you get a help message, then you are ok to run programs.

(2.2) if not, you have to install according to the instructions. :(

(3) this time type 'javac' at the prompt, this should also produce a help message.

(3.1) if you did not get the message, you need to install properly. :(

Now that we have established you can compile and run the programs, you need to write the programs.

Open a text file, and type the following in:


public class HelloAnswers {

public static main(String[] args) {

System.out.println("Hello Yahoo! Answers!");
}
}


Then save the file as HelloAnswers.java

** Hopefully, the file has not been saved with a .txt extension, such as HelloAnswers.java.txt
** If it has, then you will need to rename the file, and remove the .txt

Now, on the command line, change directory (folder) to the directory (folder) that contains the newly created HelloAnswers.java file.

Type on the command line 'javac HelloAnswers.java' without the quotes, to compile the file.

This should produce a HelloAnswers.class file upon successful compilation (compile).

You can then type 'java HelloAnswers' on the command line, and it should run the program, and print out.

'Hello Yahoo! Answers!' without the quotes.

To run in the java web start, you need to make a jar (java archive) file, and possible create a Graphical User Interface (GUI). For the GUI, you can use AWT or javax.swing

Read the API docs, and have a look for some books on java as well. I found some books called 'Core Java' published by Sun Microsystems Press to be of valuable assistance in learning java, but some others may suffice.

[edit]
Obviously the code tags do not work :P

2006-07-20 11:21:45 · answer #1 · answered by Mark aka jack573 7 · 2 0

Well, first, I would have reccomended downloading JDK 1.5 but...
Second, you need to set the path and classpath environmental variables in Windows. After you've done that, you can open a DOS shell to get a command line and type

> javac MyApp.java
> java MyApp

I recommended setting a right click option in Windows so you can open a DOS shell to any folder you right click on.

Addendum:
Right click 'My Computer' select Properties at the bottom, then Advanced Tab, then Environmental Variables button.
To the System EnVars you need to append a path the JDK's javac location. If there isn't already a classpath, add one to the user vars - classpath=.;

You may need to Google setting-up classpath and path in Windows. This the source of a lot of frustration for new Java programmers on Windows.

Or just download NetBeans Java IDE.

2006-07-16 07:59:26 · answer #2 · answered by Anonymous · 0 0

First do the path setting after down load eclipse
its free
u have to create a project from new link and crate a project and give some path after u create java class and give name of that class after writing program right click on project and click run tab and configure main class name in class and run ur program

eclipse is good tool u can debug using this tool it will give options like vb when ur using eclips u will feel comfort write java programs ok
ALL THE BEST

2006-07-17 01:38:20 · answer #3 · answered by rama s 2 · 0 0

Download JCreator, it is a nice Free editor. Java is just the language / compiler, you need an editor to write the code in.

2006-07-16 07:24:26 · answer #4 · answered by jim.walker0 2 · 0 0

"Java" only means the name of the Indonesian island in Chinese. Java is English slang for "coffee". Java is the same word used to mean "coffee" when applying to the programming language in English. Some books call it "Java Beans".

2016-03-27 07:49:00 · answer #5 · answered by ? 4 · 0 0

use notepad to write progams
use command line to comile
and to execute

2006-07-16 20:27:03 · answer #6 · answered by ihoston 3 · 0 0

fedest.com, questions and answers