This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

programs dont run  RSS feed

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone really hope someone can help me. I cannot run any programs in JBuilder. Due to:
java.lang.NoClassDefFoundError: arrayList

Exception in thread "main"

I have saved my short test program in C:\java\MyClasses and set the CLASSPATH to this from command Prompt to make sure the java file can be found but still receive this error. Any ideas how I can remedy this?
 
author and iconoclast
Sheriff
Posts: 24218
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you compiled your program with javac before trying to run it?
 
Mark Robertson
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sorry, got cut off for a while. Should I need to compile? I am just trying to run the most basic program.
 
Ranch Hand
Posts: 490
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You always need to compile a .java before it can run, regardless of size of the program. Java is not a normal interpreted language. It runs bytecode, and javac is needed to turn your .java files into .class files, which are interpreted by the JVM.
 
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mark Robertson:
... Should I need to compile? I am just trying to run the most basic program.


Indeed, a .java file is just text. It must be compiled into a .class file before it can run.

See this Hello World tutorial for a walk-through of the basic steps in compiling and running.
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After you've compiled your program, it should execute from then on. Java is different than some other languages, such as Visual Basic which lets you run your program anytime to see how it looks.
 
Sheriff
Posts: 9087
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does your program import java.util.ArrayList?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!