Cannot compile java program in Ubuntu.

Status
Not open for further replies.

mehulved

18 Till I Die............
I have started learning java now. So, I decided to practise a bit at home. For that I downloaded and installed JDK 1.5 on my system.
I am still on basics of java as I've just began. I compiled and ran one-two program without problems. But, when I come to the program below, I get an error code.
Here the program
class Temp
{
static int x=10;
public static void main(String agrs[])
{
Temp t = new Temp();
t.show();
Temp t1 = new Temp();
t1.x=20;
t1.show();
}
}

And here the error message I get
Temp.java: In class 'Temp':
Temp.java: In method 'Temp.main(java.lang.String[])':
Temp.java:7: error: Can't find method ‘show()’ in type ‘Temp’.
t.show();
^
Temp.java:10: error: Can't find method ‘show()’ in type ‘Temp’.
t1.show();
^
2 errors
This program ran fine in my classes on windows server 2000 and JDK1.3.

Also, can anyone suggest me a good, free GUI application for java pragramming eg. Jcreator, which I got but it uses too much memory.
 

desertwind

Cyborg Agent
I'm not a java programmer. Well do you define the method show() in class Temp ? The error seems to be the method missing.

The best IDE for Java for linux is NetBeans IDE. It's fully written on Java, and have many features. But a little heavy though.
*www.netbeans.org/
 
OP
M

mehulved

18 Till I Die............
I will check the program again on thursday at my classes. I guess I am going wrong somewhere. Whatever I've given in the quotes is the full program. And actually I guess you're right, I haven't defined show.
And will have a look at netbeans though something less RAM intensive will work gr8 for me as I got only 256 mb RAM.
 
OP
M

mehulved

18 Till I Die............
You'll are right. The program wasn't printed properly in the book. I checked it out and the show method is missing. I was silly enough to not realise it.
Thanks everyone foryour inputs.
 

Satissh S

Youngling
@mehul: Netbeans seriously rocks!! It isn't a memory hogg as eclipse but i good in its own right and i like it too. Try using netbeans to edit your java progs. Which jre do you use? I use Blackdown-Java and OSS implementation of Java. Besides this there are sun-java and ibm-java in gentoo - portages.
 

GNUrag

FooBar Guy
Satissh S said:
I use Blackdown-Java and OSS implementation of Java. Besides this there are sun-java and ibm-java in gentoo - portages.
Blackdown JVM is not an OSS software. It is a proprietary implementation of Sun JVM and cannot be redistributed freely.

To be able to run Java programs on a free operating system you may been to get hold of GNU Gcj and GNU Classpath packages

GNU Classpath currently has complete implementations of java.* packages and preliminary implementations of javax.swing.* packages.
 

Satissh S

Youngling
But gnurag! How come?? i was able to install it using gentoo-portage and AFAIK portage has only FOSS software collection? :roll:
 

GNUrag

FooBar Guy
Please read this: *en.wikipedia.org/wiki/Blackdown_Java


Blackdown Java is a port of Sun's Java virtual machine to Linux by a group of volunteers. It predates Sun's official Linux port. It still supports platforms the official version does not, including SPARC and PowerPC. Currently, Blackdown Java supports up to version 1.4.2 of the Java run-time libraries. Despite widespread confusion, Blackdown is neither Free Software nor Open Source.

Also: *en.wikipedia.org/wiki/Java_virtual_machine
 

GNUrag

FooBar Guy
prakash kerala said:
I use java-package to make .deb of sun-j2re and install it simple. 8)

Wouldnt it be fun if GNU Classpath could mature and we wouldnt have to use Sun's JRE then.
 
OP
M

mehulved

18 Till I Die............
@Satish I got netbeans installed but it slows down my computer to a crawl. I may be adding some RAM in my computer this week. If I do netbeans seems to be a good solution.
@anurag I got gcj already installed.I need to get classpath now? Sorry if I am getting things wrong as I am still very new to java.
If I use gcj and classpath will coding be different from using jdk on windows which is used in aptech to teach java?
 
OP
M

mehulved

18 Till I Die............
I got netbeans 5 too. I had tried to use it with Ubuntu using fluxbox wm and other application running was opera9. That too made my system to start becoming too slow to work on. I only got 256mb of RAM now. If you think the RAM is good enough than what else do you think can be the problem?
 
OP
M

mehulved

18 Till I Die............
Thanks Riyaz. Hopefully, I get more RAM this week or else I should be on a lookout for other IDE.
 
OP
M

mehulved

18 Till I Die............
I just installed 512 MB more RAM and now my computer seems to be working like breeze even with netbeans runnning. I am running fluxbox wm, besides netbeans opera and FF are also running without straining the computer at all.
 

Satissh S

Youngling
@mehul_ved:
Nice!! Did you notice the difference while running fluxbox? It's extremely customisable too!
But i use FVWM2 which is more so customisable and you can keep your favourite apps right at your finger tips. It uses the same amt of memory.
Imagine running kde, with these apps open!!
 
OP
M

mehulved

18 Till I Die............
Yeah it does make a lot of difference. Well I haven't customised Fluxbox as yet. I am off to installing gentoo now.
Netbeans seems a bit complicated as of now but I will use it since it seems gr8 and many of you'll have recommended it. Thanks everyone for the replies. Will tryout gcj, classpath and netbeans.
 

Satissh S

Youngling
Hey! I suggest to do a gentoo stage 1 install.. REally it's the better choice. You'll notice the differnce. Here is a document i found very very useful. You can Follow it as such. Good Luck!!
*gentoo-wiki.com/HOWTO_Newbie_Guide_to_Stage1_NPTL_Install#TESTING
 
Status
Not open for further replies.
Top Bottom