Specifically if you are a new Java programmer or a new Java programmer on Windows 7, you will probably need to set up an environment first for Java.

image

Alternatively though you may need tools like Eclipse, but to go in hard code Geek way, here is what you need to do…

  1. Right click Computer from the Start menu
  2. Choose System Properties from the context menu
  3. Click Advanced system settings > Advanced tab
  4. Click on Environment Variables, under System Variables, find PATH, and click on it.
  5. In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.

    image

  6. PATH probably will be C:\Program Files\Java\jdk1.7.0\bin\
  7. Reopen Command prompt window, and run your java code.

Also To Compile & Execute code as always have these commands :

Compilation  javac ExampleProgram.java
Execution    java ExampleProgram

Sometimes in the initial startup you may face an Error or might have trouble compiling and running Java code. An error like "Error: Could not find or load main class <classname>” is quiet common.

To solve which You must ensure that you add the location of your .class file to your classpath. So, if its in the current folder then add . to your classpath.

Example : javac -classpath .; *.java

One thought on “Windows 7 for Java Programmers”

  1. Good method use this for porgramming. But using BlueJ or eclipse. Bleuj is the preferred environment for us in ICSE. I used use NetBeans. Preffer BlueJ but Eclipse has a plethora of options. Rarely use CMD to execute java programm. CMD method is cumbersome. For starters main() is compulsary and the parameterized input cant be taken.

Leave a Reply to bala Cancel reply

Your email address will not be published. Required fields are marked *