Compiling Project using Java 2 SDK (J2SDK)

Asked By 10 points N/A Posted on -
qa-featured

I downloaded Java 2 SDK (J2SDK),  a compiler for Java.  I am studying on how to create Java application. I found so many tutorials and codes on the internet but the problem I am having right now is that I don’t know how to start or open a new blank project and how to compile it. Can you help me?

SHARE
Answered By 0 points N/A #105312

Compiling Project using Java 2 SDK (J2SDK)

qa-featured

If you are using Windows, go to Notepad or any other Editor. Put the code there.

1. Be sure that the first letter of every word in the class name is capitalized and without spacing.

 

2. When saving, the file name must be the same from the class name and with extension of .java.

 

 

3. Once saved, go to Start Menu and then Run and type cmd.

 

4. Have you set the path of JDK?

If not, go to the folder where Java is installed.

 

5. Copy the address where the bin folder is located in your Java folder.

6. Go to command prompt, type path= (type or copy paste the address).

 

7. Press Enter. To check if the path is configured correctly enter javac and you will see something like this.

 

8. In order to run your program, go to the folder where you saved your file using the command prompt or CMD. 

Once in the proper directory, you need to type javac <space> file name.java

Example: javac PasswordValidator.java

 

9. If no error occurred, type java filename

Example: java PasswordValidator

 

And there you have it, that is the way to run and compile your java programs on Windows.

Login/Register to Answer

Related Questions