Solved

Unable to run java program

Posted on 2007-03-22
5
222 Views
Last Modified: 2013-11-23
Hi,

My lecturer has given us a sample java program which consists of three java files.
1) Create.java
2) Record.java
3) Enrol.java

As instructed by her, we have to do the following steps:
Compile Record.java
Compile Create.java
Run Create.java
Run Entrol.java

However, I encountered errors when running Enrol.java. Can someone please help? I would very much like to seek help from her but as my course is a part-time basis, the earliest date i can see her is next week.

Please advise. The sample files are found at http://test.swenlee.com/java.html
0
Comment
Question by:dandeliondream
5 Comments
 

Expert Comment

by:anarancio
ID: 18777801
Could you paste the exception that are you getting?
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 18777825
Is it giving NoClassDefFound?, then set the classpath to ccurrent directory

java -cp . Create
java -cp . Enrol
0
 
LVL 9

Accepted Solution

by:
arioh earned 250 total points
ID: 18777839
i suppose, the instructions must be:
Compile Record.java
Compile Create.java
!  Compile Enrol.java
Run Create.java
Run Enrol.java
0
 
LVL 12

Expert Comment

by:keyurkarnik
ID: 18777948
This is what you need to do :

Copy all the java files and put them in a single directory (leave thenm if they already are)

Open command prompt and go to the directory - at the prompt, do this

javac *.java

---This will result in all the class files being generated

--Now to run Create

java -classpath . Create


-- To run Enrol

java -classpath . Enrol



See the '.' in the command - its for setting the classpath to current directory so that java knows where to pick up the class files from.
0
 
LVL 3

Author Comment

by:dandeliondream
ID: 18778016
Thanks arioh for your comments. It works now!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JavaScript/Java - Changing an image background color 4 66
table example 4 29
Capture logon name 13 73
spring jars download 1 27
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question