Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error when executing project on JCreatorLE

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And please confirm you are using your real name. See this page.
 
winnie Lim
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you had any luck with it?
 
winnie Lim
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks! works like a charm! after lots of fiddling though
 
Campbell Ritchie
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
winnie Lim
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic