Solved

Unable to run java program

Posted on 2007-03-22
5
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

696 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