Notice

Join This Channel To Get Latest Phone Tips,Tricks,News,Network Security Course,Hacks etc. For Free on Your Mobile!! ... Join our Facebook Discussion Group -Regards Ankit
Showing posts with label JAVA. Show all posts
Showing posts with label JAVA. Show all posts

02 January 2012

Setting Path For Java Programs



You can run Java applications just fine without setting the PATH environment variable. Or, you can optionally set it as a convenience.
Set the PATH environment variable if you want to be able to conveniently run the executables (javac.exe, java.exe, javadoc.exe, and so on) from any directory without having to type the full path of the command. If you do not set the PATH variable, you need to specify the full path to the executable every time you run it, such as:

C:\Java\jdk\bin\javac program.java

The Method:

Open Notepad,Write The Following Code.
PATH=C:/java/jdk/bin
Save it as setpath.bat
Now,You Can Run The Program Without Navigating to Directory.
There is only disadvantage in this Method.You have to Run setpath.bat each time you Restart your Computer.
There is Another Method For Setting Class Path Permanently.
It Can be Found on Official Oracle Site Here.

Keep Checking.More Java Tutorials To Be Posted...!

Enjoy...

Running Your First Java Program



This Post is written for L.L.J Series.

This is How You Can Run Your First Program in Java.

1. Install JDK.It Can Be Found Here.
2. Use a IDE (I am Using Notepad Here)
3. Write Your First Program and save it in:

C:/java/jdk/bin

4. Make Sure You Save The File With Same Name as Main Class File.
e.g:
We are Writing The Code:
class Sample
{
public static void main(String s[])
    {
      System.out.println("Tech_Labs.java");
    }
}

We Will Save the Following Program with Name: Sample.java
First Run Command Prompt and Navigate to C;/java/jdk/bin.

Now,Run the Program using These Commands:
javac Sample.java
java Sample

Congrats! You have Just Executed Your First Java Program.
Enjoy...

Views This Month

 

HaCk-O-PeDia - The Hacker's Encyclopedia. Copyright 2010 All Rights Reserved To Ankit