aspose file tools*
The moose likes Beginning Java and the fly likes Error when executing project on JCreatorLE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error when executing project on JCreatorLE" Watch "Error when executing project on JCreatorLE" New topic
Author

Error when executing project on JCreatorLE

winnie Lim
Greenhorn

Joined: Feb 10, 2009
Posts: 16
Hi!

I am a new student in Java Programming and have been instructed to use JCreatorLE for my programming. However when i tried to do my assignment codes and saved it and ran it, it could compile fine but when it ran, it gave me an error of:

GE2001 Version 1.4
Error : Invalid Path, /bin/java.exe - classpath C:/Desktop/MainMenu

Press any key to continue - and it terminates the program.

When i saved my test program i used the file name MainMenu.java and the codes are below:

import java.util.Scanner;
public class MainMenu
{
public static void main (String[]args)


{


Scanner scan = newScanner (System.in);
System.out.print ("The Module Registration System Main Menu");

}
}

Plese advise me on what went wrong with my JCreatorLE as i have a deadline to rush which is rather pressing.

Thanks a million!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
So, what have you set your PATH to? And why did you set a CLASSPATH at all? Why are you keeping all your Java work on your desktop?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
And please confirm you are using your real name. See this page.
winnie Lim
Greenhorn

Joined: Feb 10, 2009
Posts: 16
Campbell Ritchie wrote:So, what have you set your PATH to? And why did you set a CLASSPATH at all? Why are you keeping all your Java work on your desktop?


i don't get you? What do you mean by setting PATH? and classpath?

sorry for the questions cause this is really my 1st java program i'm testing out
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
Thank you for correcting your name.

That is your very first program, and you have never got one to run before? Which OS are you using? From the C: at the beginning, it looks like Windows.

I presume you have installed Java, which you download from here. You want what is called JDK 6 update 12. Not JRE. It should be 73MB to download. The update 12 is very new; I haven't seen it before. Install in the usual fashion, but when you get to the bit about "install in this folder?" you can install it wherever you like, but record carefully the exact name of the folder you installed it in.
You will need that for setting the PATH, which is described in the installation instructions. Remember you want JDK, not JRE. You will see something about setting the PATH permanently. Do what it says there. You will need the name of the installation folder, and you use that to make a PATH entry, which starts with the drive letter, usually C, and ends with bin. Remember: the slightest spelling error and it won't work. Test it by writing

javac -version

at the command prompt. If you get something like "1.6.0_12" you have got it right. If you get "javac is not recognized . . ." you have not got it right.

When you installed JCreator it will have asked for your Java installation. You will probably have to tell it to look for a new installation now.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
Have you had any luck with it?
winnie Lim
Greenhorn

Joined: Feb 10, 2009
Posts: 16
thanks! works like a charm! after lots of fiddling though
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
When I tried installing Java it said it was installing into a folder called C:\Program Files\Java\JRE. When I explored the Java folder, there were other folders in it, the newest being

C:\Program Files\Java\jdk1.6.0_12

so I added C:\Program Files\Java\jdk1.6.0_12\bin to my PATH

This is what happens on my command prompt.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Campbell>PATH
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Ja
va\jdk1.6.0_12\bin
Note the awkward line wrapping.
winnie Lim
Greenhorn

Joined: Feb 10, 2009
Posts: 16


you were a great help

now i gotta slog through my assignment, hopefully will be able to scrape through. I have a lousy lecturer who speaks Martian
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
You're welcome
winnie Lim
Greenhorn

Joined: Feb 10, 2009
Posts: 16
hi there i have some questions regarding declaration of methods in a class. I've started a little but ain't sure if i'm on the right track or not. Also i'm not sure what goes into the methods or how to declare. Anyone can point me in the right direction ? Thanks alot!

3. The School
class represents the Module Registration System in a school. It has three properties:
the schoolName (String), and two collection lists, namely moduleList(ArrayList of
modules) and studentList( ArrayList of students.
The class has the following methods:
䀁ؠaddStudent – This method accepts a Student object and adds it to the
studentList.
䀁ؠaddModule – This method accepts a Module object and adds it to the
moduleList collection.
䀁ؠremoveStudent - This method accepts a int representing the studentID and
searches for the student within the studentList collection. It returns true when
the student is found, and removed from the studentList. Otherwise it returns
false.
䀁ؠremoveModule - This method accepts a int representing the moduleID and
searches for the module within the moduleList collection. It returns true when
the module is found, and removed from the moduleList. Otherwise it returns
false.
䀁ؠsearchStudent – This method accepts an int representing the studentID and
searches for the student within the collection of students. It returns the student
if found, otherwise it returns a null value.
䀁ؠsearchModule – This method accepts an int representing the moduleID and
searches for the module within the collection of modules. It returns the module
if found, otherwise it returns a null value.
䀁ؠlistModules – This method goes through the collection of the modules and
displays all the information of each module in the moduleList.
䀁ؠlistStudents – This method goes through the collection of the students and
displays all the information of each student in the studentList.
䀁ؠclassFull - accepts a moduleID (int) and checks if the classLimit for the
module has been reached.
䀁ؠisOfferedInSem - accepts a moduleID (int) and a sem (int). It checks if the
module is offered in the semester sem.
䀁ؠregisterModule – This method accepts a studentID (int), a moduleID (int) and
a semester (int). Returns true when the module is added to the module list in
the Student object. Otherwise it returns false.

䀁ؠListModulesTaken – This method accepts a studentID (int) and display a list
of modules taken by the student in the format shown below.
005 Tan Ah Teck
101 Programming Fundamentals
202 Intermediate Programming

What i have done so far is



Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
Thank you. That last question might have been better in a new thread, since it appears to be a new problem.
Your method headings look correct to me, just on a very quick look, now you will have to work out for yourself what you write in the methods.

By the way: this looks very complicated for a "first" Java program. Please ask your teachers about how you are supposed to use an int to find a Student in a List. That seems an awkward bit of programming.
winnie Lim
Greenhorn

Joined: Feb 10, 2009
Posts: 16
yeah unfortunately this is a first java program for me....

So the method headings are correct? May i ask what are constructors and how to declare one?

thanks for your advice.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38798
    
  23
A constructor sets up the initial values of all the fields. In my opinion, it is best to set up every field with its initial value in the constructor (except possibly for static fields). If you need to pass values, they are passed as parameters exactly the same way as for a method.
A constructor heading starts with an access modifier (eg private, public: at your stage go for "public" until proven otherwise.
Then it has an identifier which is exactly the same as the name of the class.
The it has a pair of round brackets () which may or may not contain parameters.

You always miss out a return type for a constructor.

Example
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error when executing project on JCreatorLE