Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-11-2008, 07:04 PM   #1
Registered: Nov 2007
Posts: 148

Rep: Reputation: 15
how to run a java program in fedora 8

i have installed fedora 8 -i386 version on my lap..
can neone tell me how to run program in fedora8

suppose i have made a program

class hello
public static void main(String args[])
System.out.println("hello world");

now wat shall i do to run it...
Old 05-11-2008, 07:43 PM   #2
Registered: Apr 2004
Distribution: Slackware 11.0, Gentoo
Posts: 252

Rep: Reputation: 31
1. Compile it

2. Run it
java hello.class
Old 05-11-2008, 07:44 PM   #3
Registered: Jun 2005
Location: Kentucky
Distribution: Ubuntu
Posts: 794

Rep: Reputation: 56
Running scripts from the command line is good because if they crash any errors they spit out will be displayed in the terminal for you to read over.

Edited cause' the question was answered above.
Old 05-12-2008, 01:22 AM   #4
Registered: Mar 2008
Posts: 53

Rep: Reputation: 15
Add public specifier to else your class becomes private.
Old 05-23-2008, 05:16 PM   #5
Registered: Nov 2007
Posts: 148

Original Poster
Rep: Reputation: 15
my program got compiled successfully but when i typed java hello.class
i got the following error..
java hello.class
Exception in thread "main" java.lang.NoClassDefFoundError: hello/class
Caused by: java.lang.ClassNotFoundException: hello.class
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
Error: Could not find the main class.
Error: A JNI error has occurred, please check your installation and try again

i have installed fedora 8 in my lap..
don i need to install anything from net for running java programs ..or it comes along with fedora 8 dvd...
Old 05-24-2008, 01:15 AM   #6
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You don't need the ".class" - you just run "java hello".
Old 05-28-2008, 04:55 PM   #7
Registered: Nov 2007
Posts: 148

Original Poster
Rep: Reputation: 15
thaanx a lot man...
it worked..

is there any
hey just like we have netbeans in windows for running java programs there any software in linux too ...where this compiling and running can be done with the help of some shortcuts...
Old 05-28-2008, 09:19 PM   #8
Registered: Feb 2008
Location: Uns Cigano from Vigol
Distribution: FreeBSD 8.0
Posts: 59

Rep: Reputation: 19
how to run a java program in fedora 8 Reply to Thread


1. First of all : The method that Nylex mentioned is practical for other Env(s).
2. Then, about some equivalent Apps/Utils for (Win/Java)->(Linux/Java)|(GNU/Java).
2.1. Build tools : Ant
2.2. Issue trackers : Bugzilla / iTracker
2.3. Continuous integration : Cruise Control
2.4. Version Control : CVS / subversion
2.5. IDE : Eclipse / JDeveloper / NetBeans IDE 6.0 Beta 1
2.6. Office : gnome office /
2.7. DB : HSQLDB / MySql / PostgreSQL
2.8. Web Server / J2EE Container : JBossGeronimo / Apache Tomcat
2.9. UML : Jude / Umbrello
2.10. Building : Maven
2.11. Project managment : XPlanner
2.12. and ... : Apache Harmony / Apache Commons Math / Apache POI / Apache Derby / MyFaces Core

mehrshad moslehi


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
Trying to run a java program vmelkon Ubuntu 6 05-30-2007 07:05 AM
How to run JAR from within Java program ?! EAD Programming 1 12-31-2006 08:11 PM
Can't run two instances of a java program audibel Linux - Software 0 02-19-2005 05:01 PM
error when run java program vanhelsing Programming 8 12-24-2004 03:23 AM
How to run a command through a Java program kernelvn Programming 3 12-02-2004 10:25 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:20 PM.

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