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 hello.java 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... |
1. Compile it
javac hello.java 2. Run it java hello.class |
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. |
Add public specifier to else your class becomes private.
|
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 java.net.URLClassLoader$1.run(URLClassLoader.java:221) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:209) at java.lang.ClassLoader.loadClass(ClassLoader.java:324) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:269) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337) 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... |
You don't need the ".class" - you just run "java hello".
|
thaanx a lot man...
it worked.. is there any hey just like we have netbeans in windows for running java programs ....is there any software in linux too ...where this compiling and running can be done with the help of some shortcuts... |
how to run a java program in fedora 8 Reply to Thread
Hi 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 / OpenOffice.org 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 Bye vigol mehrshad moslehi www.vigol.com |
All times are GMT -5. The time now is 02:44 AM. |