View Full Version : [SOLVED] cannot compile java program

February 25th, 2012, 11:56 AM
I hate to ask questions but I am at lost now. i have browse the forum for 1 hour without success.
I am planning to use ubuntu to write java programs and i have installed visualVM from software centre. But when i tired to test the java program i have written it gives the following error.
************************************************** ****************
bariamtak@bariamtak-pc:~$ cd Desktop
bariamtak@bariamtak-pc:~/Desktop$ javac dyninit.java
dyninit.java:7: package system does not exist
system.out.println("hypotenuse is " +c);
1 error
************************************************** *****************
I am in ubuntu 11.10. Can you please tell me i need to do.
thank you.

February 25th, 2012, 12:05 PM
Hi, welcome to the forums

It looks like you have an error in your java not with your Ubuntu system:


Maybe using an IDE (eg. Eclipse (https://help.ubuntu.com/community/EclipseIDE)) with a built in compiler might help you while you're getting started? They can help you identify where the errors are in your code

February 25th, 2012, 12:07 PM
Try this as this appears to be one of the packages not installed

Type these in a terminal

sudo apt-get install javacc

Have you tried eclipse too

sudo apt-get install eclipse

February 25th, 2012, 12:10 PM
thank you for repying. I'll try eclipse and get back to you.

February 25th, 2012, 12:18 PM
Shouldn't it be System, with a capital S? Or is that just a typo in the forum post?

February 25th, 2012, 12:37 PM
Thank You benson444 .
what a silly mistake ! I am new in linux so i was quick in putting the blame on it. Sorry ma bad !

The Cog
February 25th, 2012, 12:39 PM
Yup. Follow the link that greenpeace gave in post #2.

Moved to Programming Talk.