Solved

Unable to run java program

Posted on 2007-03-22
5
220 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
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.

896 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now