LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-21-2006, 08:30 PM   #1
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Java Runtime Errors


I've decided to learn Java (*round of applause*).

I installed the most recent version of J2SE JDK from java.sun.com and I was able to install jEdit with it, and LimeWire seems to be running fine, so I've figured I've got it installed correctly.

Now, I wrote a simple program - the cornerstone "Hello World" first program:
Code:
public class HelloWorld {
     public static void main(String args[]) {
          System.out.println("Hello World!");
     }
}
I go "javac HelloWorld.java" and it compiles with no errors ( I even threw in random crap just to check to make sure it would check for errors ). Then I run "java HelloWorld.class" and I get this error (every time!!!):
Code:
Exception in thread "main" java.lang.NoClassDefFoundError: //HelloWorld/class
I'm personally finding this a little frustrating...I'm trying to learn a language that's said to be easy and fast, and so far, it's neither.
 
Old 03-21-2006, 09:51 PM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.3, Oracle Linux, Mint, Tribblix
Posts: 9,742

Rep: Reputation: 455Reputation: 455Reputation: 455Reputation: 455Reputation: 455
This very same question is asked quite often ...

run "java HelloWorld", without the .class appended.
 
Old 03-23-2006, 03:16 PM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Original Poster
Rep: Reputation: 65
Brilliant!

Thanks a bunch.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Programming: Java Runtime Environment not found when trying to compile murbz Linux - Software 2 03-26-2009 03:04 AM
How can I use Java runtime? annemarietjuhhh Linux - Newbie 8 02-28-2006 02:41 PM
Java runtime environment Ab3n Linux - Newbie 5 08-19-2005 03:50 PM
java runtime shariqali Linux - Software 7 09-23-2003 10:08 PM
setting up java runtime FloatRed Linux - Newbie 4 09-24-2002 08:43 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration