Results 1 to 3 of 3
Thread: Basic question about compiling
- 10-28-2009, 09:54 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
Basic question about compiling
Hello! Im starting to learn Java on my spare time (I just realised I dont like Pascal anymore), and I've come across a curious problem.
I've made a simple (very simple!) program under Geany on Linux. Here is the souce
I can compile it and run it succesfuly on Geany. But when I try the manual approach, compiling and running from a terminal, I get this:Java Code:import java.util.*; class Suma{ public static void main(String args[]){ Scanner a = new Scanner(System.in); System.out.println("Dame un número"); int b = a.nextInt(); System.out.println("Dame otro número"); int c = a.nextInt(); System.out.println("La suma de " + b + " y " + c + " es " + (c+b)); } }
That comes after succesfuly compiling the program via javac. To be honest, I dont really know much about linux either. So I'd like if you could explain what went wrong here. Thanks for your help.Java Code:santiago@Samorost:~/Java$ java Suma.class Exception in thread "main" java.lang.NoClassDefFoundError: Suma/class Caused by: java.lang.ClassNotFoundException: Suma.class at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336) Could not find the main class: Suma.class. Program will exit. santiago@Samorost:~/Java$
PD: By the way, I just joined the forums. I'd also like to say hi to the community. ;)
- 10-28-2009, 09:57 AM #2
Hi!!!!!!!!!!!
Welcome to Java forum!!!!!!!
when u run take out .class.Go thru sun site for understanding fundas.
java SumaRamya:cool:
- 10-28-2009, 10:08 AM #3
Member
- Join Date
- Oct 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Netbeans newbie question on compiling
By DaFlake in forum NetBeansReplies: 4Last Post: 07-30-2009, 07:04 PM -
Basic question on OOP.
By madthinker in forum New To JavaReplies: 7Last Post: 01-26-2009, 07:09 PM -
Basic question about EJB
By javaplus in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 07-15-2008, 05:44 PM -
Very basic question
By gvi in forum New To JavaReplies: 2Last Post: 10-30-2007, 06:30 PM -
basic question about files
By oregon in forum New To JavaReplies: 1Last Post: 08-05-2007, 02:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks