5 Replies - 735 Views - Last Post: 19 November 2009 - 04:43 PM Rate Topic: -----

#1 bita  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 190
  • Joined: 21-April 09

java first project

Posted 19 November 2009 - 12:42 AM

hi

i'm trying to making a java project for first time.i've opened notepad,save my project az "b.java" but it just saved az notepad and there is not any class file so keep receiving this error while i want to run it in command :'java.lang.noclassfounderror'

is there anyone who can help me with this classpath error?
Is This A Good Question/Topic? 0
  • +

Replies To: java first project

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5395
  • View blog
  • Posts: 27,389
  • Joined: 10-May 07

Re: java first project

Posted 19 November 2009 - 12:47 AM

Did you set the paths for your Java environment with your OS?
Was This Post Helpful? 1
  • +
  • -

#3 bita  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 190
  • Joined: 21-April 09

Re: java first project

Posted 19 November 2009 - 01:28 AM

View Postno2pencil, on 19 Nov, 2009 - 10:17 AM, said:

Did you set the paths for your Java environment with your OS?



i'm sure of path,but not path class i did sth like this in pathclass variable value:

'.;C:\Program Files\Java\jdk1.6.0\bin;C:\Program Files\Java\j2re1.4.2_03\lib\ext\QTJava.zip'

but still i have the same error :(
Was This Post Helpful? 0
  • +
  • -

#4 virgul  Icon User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 269
  • Joined: 18-March 09

Re: java first project

Posted 19 November 2009 - 01:54 AM

Try using a program such as
Bluej
Eclipse
Dr. Java

or some other IDE to program in, not only to the provide the convince of helping you with your problem, but they also deal with compiling the program and running it
Was This Post Helpful? 1
  • +
  • -

#5 rajeakshay  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 17
  • Joined: 19-March 09

Re: java first project

Posted 19 November 2009 - 02:41 AM

When u save your b.java file make sure the Save As Type is set to 'All Files'.

Then u say you are having problems with the path. I suggest you open the Command Prompt and type this:
javac

If this lists all the various command line options with javac (Java Compiler) then u hav installed Java correctly and u hav correctly set the paths. If u get an error like " javac not a recognised command " or something like that, then check ur path again.

When u hav written your code in Notepad and saved it as b.java, open Prompt and go to the directory u r working in, then type:
javac b.java
This will create b.class file if there are no syntactical errors in ur code. (I hope u know dat the name of ur public class in java file must be b i.e. same as the filename :D .) Then run your program with:
 java b


PS: I dont know what u really did with the path variable. What I did when I installed Java was I created a new User variable called path and set it to C:\Program Files\Java\jdk1.6.0\bin. Thats it and my java codes ran neatly. I dont know abt the QTJava.zip file u hav mentioned. But if its used in ur project then may be it must stay that way.
Was This Post Helpful? 1
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8347
  • View blog
  • Posts: 31,910
  • Joined: 06-March 08

Re: java first project

Posted 19 November 2009 - 04:43 PM

If you save your program into b.java it must at least have these lines

class b {

   public static void main(Strings[] args) {
   }
}



to make sure that "java b" invokes the main() class you can add one line

class b {

   public static void main(Strings[] args) {
		System.out.println("Hello Java");
   }
}





View Postno2pencil, on 18 Nov, 2009 - 11:47 PM, said:

Did you set the paths for your Java environment with your OS?

If she receives 'java.lang.noclassfounderror'
the paths are OK
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1