Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Beginner Java Programmer

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
lostinlinux
Guru
Guru
User avatar
Posts: 341
Joined: Sat Oct 05, 2002 3:18 pm

Beginner Java Programmer

  • Quote

Post by lostinlinux » Sat Feb 28, 2004 9:59 pm

Ok, I am trying to learn some java and for some reason whenever I try to run java on even the simplest of files I get an error as follows:

Code: Select all

bash-2.05b$ java Hello.class
Exception in thread "main" java.lang.NoClassDefFoundError: Hello/class
The Program is simple and is this (I included javax.servlet only to make sure it was reading my classpath right)

Code: Select all

import java.util.*;
import javax.servlet.*;

public class Hello {
        public static void main(String[] args) {
                System.out.println("Test Output");
        }
}
I am really new to the java world so I have no clue how o go about fixing this, if anyone has any ideas I'd appreciate it
So many questions so little time....
Top
yak8998
n00b
n00b
Posts: 35
Joined: Fri Jun 06, 2003 11:24 pm

  • Quote

Post by yak8998 » Sat Feb 28, 2004 10:14 pm

you dont need to type the .class at the end, you just type

Code: Select all

java Hello
EDIT: oh, FYI, you don't need to import any packages for that simple program
"ignorance is bliss for stupid people."
www.primotechnology.com
Top
Beholders_Eye
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 116
Joined: Mon Nov 17, 2003 10:24 am
Location: Brazil

Re: Beginner Java Programmer

  • Quote

Post by Beholders_Eye » Sat Feb 28, 2004 10:15 pm

You have to export the CLASSPATH of your local dir for java to find your newly compiled out class...

Code: Select all

export CLASSPATH=$CLASSPATH:.
Should be enough, but I, personally don't like this approach. I'd recommend that you try out Eclipse to learn something out of java.

Code: Select all

emerge eclipse-sdk
Top
lostinlinux
Guru
Guru
User avatar
Posts: 341
Joined: Sat Oct 05, 2002 3:18 pm

  • Quote

Post by lostinlinux » Sat Feb 28, 2004 10:52 pm

ah gotcha, it was just a matter of not typing the .class at the end, thanks a lot, lol, funny how something so easy is so easily overlooked. I am aware of not having to import anything but I just wanted to make sure that the classpath was setup. Thanks again
So many questions so little time....
Top
Post Reply

4 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic