#### Archived

This topic is now archived and is closed to further replies.

# [java] Java Newbie - Compiler problems ??

## Recommended Posts

I am seeking some help and advice from those of you who use Java either as their first choice language or use it most of the time. I am using Microsoft Visual J++ 6.0 after being given it free. I have also just done a Java programming home course. I can program in C++ so the learning curve was not too steep. I currently use Microsoft Visual C++ 6.0 for my C++ programming. This is why I am keen to use the MS Java program because the setup is very similiar and I like using it. My problem comes into play when after completing the course I now try and type in the programs and compile them. They do not work, in fact I have had to make changes to the program to get it to work. Now have I been taught incorrectly how to program in Java or is it simply the MS Java program which is not setup correctly? I have been told the MS program I am using uses only Java 1.1 and the current one is 1.4.1. This is the program I was given as an example to follow and is supposed to work and is a Java program. import java.io.*; public class Class1 { public static void main (String [] args) throws IOException { int num1, num2, sum; System.out.println ("Input a number: "); num1 = Course_io.readInt(); System.out.println ("Input another number: "); num2 = Course_io.readInt(); sum = num1 + num2; System.out.println ("The total is " + sum ); } } The error I get is, "Undefined name ''Course_io'' (j0049) Why? Have I not set up the compiler correctly or is the MS Vis J++ 6 compiler just a waste of time. If so, then why is it still available to purchase in shops? I don''t want to know how to get the program to work, rather what the problem is with compilers etc... Sorry for the huge post but I would really appreciate some help on this frustrating matter. Thanks, Pk

##### Share on other sites
I tried compiling it with what I think is Sun''s newest compiler and Course_io is undefined. So I don''t think J++ is the problem

Looks to me like you''re using something you got from that Java programming home course, you probably need Course_io.class or something...

By the way I don''t care either way, but it''s a bad idea to be using J++ and Java in the same post, every time I''ve seen someone talk about it someone else got very offended.

##### Share on other sites
The problem isn't with the compilers...... but since you don't want to know how to get the program working I won't tell you.....

The compiler has told you what is wrong-they don't *usually* lie about these things. It can't find any references to the class Course_io, from the name I would say that this is a piece of code that your course tutor put together to take care of the fiddly details of getting numbers from the console. It can't find this piece of code. Have you got a file called 'Course_io.class' or 'Course_io.java'??? If not, then you need to find it to get it working and put it in the same directory as your other code. If it still doesn't work but gives the same error then you'll have to look at your course notes, should say there how to get the piece of code working, and since you've done it once, it shouldn't be too difficult!

Jiim Jonez
www.javage.net

[edited by - Jiim on November 2, 2002 10:28:37 AM]

##### Share on other sites
Hi there fellow Java Programmer!
The first course in Java I took was my 1st yr. programming class somputer science 101 ... in this class everyone had learn how to use the command line tools provided by Sun, ie. javac, java, javadoc, etc. I think there is a good reason(s) for that, Sun created Java, you can get those tools for FREE as they are part of every SDK, and you can count on them being in new versions of SDK(s) too ... but the most important reason for using those is that they are fast and easy to use, ie. need to compile .. just run "javac MyClass.java", to run your program "java MyClass", to create an API of your class "javacdoc MyClass.java"

Here is my "biased" opinion on J++

J++ was made by Microsoft, and so they decided to brake some java standards asap , by adding their own extensions to Java, ... but thankfully they were sued by Sun.

Now since they can''t control/mold java into windows only or windows optimized, they came up with a java like language C#.
So don''t expect to see a new version of J++, since Microsoft is no longer interested in Java.

##### Share on other sites
Just wanna say thanks for the replies, it has really helped me out. I am going to start using the Sun compiler rather than the Microsoft thing I was given.

Thanks again for all the advice it has been invaluable!

##### Share on other sites
www.jcreator.com

After you''ve got the java SDK from Sun''s website and ditched J++, try this IDE. It''s free and has a very similar setup to Visual C++ (90% of the time shortcuts etc. are identical )

##### Share on other sites
If you''re look ing for some good java tutorials, then I''d also recomend the ones on Sun''s java pages, they have done a great job on those tutorials.
To find them go to Sun''s Java web page "www.java.sun.com", then click on tutorials, and then on The Java Tutorial (Java Series).
And you should end up here "http://java.sun.com/docs/books/tutorial/index.html"

Once there you''ll find all the info on where to get latest SDK 1.4 (or just 1.1 if you wont that), how to install it, and how to use it, in Windows, Unix, Linux, and Mac

Have fun with Java!

##### Share on other sites
Actually, J++ was pretty easy to use. I liked the VB-style (X,Y) layout far more than the usual Java "fill all the space" deal that Borland and most others use, for instance. I have seen mentioned a Java layout manager that lets you use X,Y coordinates instead; lemme know if there''s any info online about how to do it.
....
Problems were that it wasn''t standard Java, it had lots of bugs (I remember it often crashing at my schools computers, as well as on home computers of students) and worse, now it''s basically abandonware.
~
JCreator is it: easy to use, and free.
If you find that it is missing some feature you need, try Netbeans (also free).

##### Share on other sites
quote:
Original post by Sir_Spritely
I am seeking some help and advice from those of you who use Java either as their first choice language or use it most of the time.

I am using Microsoft Visual J++ 6.0 after being given it free. I have also just done a Java programming home course. I can program in C++ so the learning curve was not too steep. I currently use Microsoft Visual C++ 6.0 for my C++ programming. This is why I am keen to use the MS Java program because the setup is very similiar and I like using it.

My problem comes into play when after completing the course I now try and type in the programs and compile them. They do not work, in fact I have had to make changes to the program to get it to work.

Now have I been taught incorrectly how to program in Java or is it simply the MS Java program which is not setup correctly? I have been told the MS program I am using uses only Java 1.1 and the current one is 1.4.1.

This is the program I was given as an example to follow and is supposed to work and is a Java program.

import java.io.*;
public class Class1
{
public static void main (String [] args)
throws IOException
{
int num1, num2, sum;
System.out.println ("Input a number: ");
System.out.println ("Input another number: ");
sum = num1 + num2;
System.out.println ("The total is " + sum );
}
}

The error I get is, "Undefined name 'Course_io' (j0049)

Why? Have I not set up the compiler correctly or is the MS Vis J++ 6 compiler just a waste of time. If so, then why is it still available to purchase in shops?

I don't want to know how to get the program to work, rather what the problem is with compilers etc...

Sorry for the huge post but I would really appreciate some help on this frustrating matter.

Thanks,

Pk

I took a java course and we were taught to use bufferedreader get input. Besides I believe if you want to use Course_io you have to use a constructor like this:

this allow me to use dataIn.readLine(); and Integer.parseInt allows me to convert the string I got from the user to an Integer.

here some source code to demonstrate it. It's full functional (at least when I compiled it witht the JDK from sun).

    import java.io.*;public class Case4{	public static void main(String[] args) throws IOException	{		BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));				//Declare Variable		String strUserNumber;		int userNumber;		int dollars;		int cents;				//Get user input                System.out.print("Enter a number:");			strUserNumber = dataIn.readLine();		//Conversions		userNumber = Integer.parseInt(strUserNumber);		//Calculations		cents = userNumber % 100;		dollars = (userNumber - cents) / 100;		//Output		System.out.print(dollars + " Dollars and " + cents + " Cents\n");		System.out.print("\$" + dollars + "." + cents);			}}

there is nothing wrong with your compiler, it seems you just forgot some code.

[edited by - prh99 on November 6, 2002 12:23:49 AM]

• ### Forum Statistics

• Total Topics
628401
• Total Posts
2982463

• 9
• 10
• 9
• 19
• 24