ashokkumar
command prompt is compilation is not working
3 Answer(s)      4 years and 8 months ago
Posted in : Java Beginners

Dear java users can anyone help me to run the program in command line prompt i tried by selecting the environment variable and class path and path in my system my program is compiling and generation the class file using javac c:\helloworld.java command and the class file is also getting generated when i run the class file using java helloworld through command prompt class not found error and class loader not able to load and many exception are coming can anyone help me to sort this problem please and iam using windows 7 os

thanking u from ashokkumar

Ads

View Answers

January 16, 2012 at 12:43 PM


Hi,

Post the error. Where is your class located? Is it in C:// drive?



January 16, 2012 at 1:00 PM


hai

the error is class not found exception java.lang.class not found exception

E:\Users\ASHOKKUMAR R>"javac" "e:\Program Files\Java\HelloWorld.java"

E:\Users\ASHOKKUMAR R>"java" "e:\Program Files\Java\HelloWorld"
Exception in thread "main" java.lang.NoClassDefFoundError: e:\Program Files\Java
\HelloWorld
Caused by: java.lang.ClassNotFoundException: e:\Program Files\Java\HelloWorld
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: e:\Program Files\Java\HelloWorld.  Program will e
xit.

E:\Users\ASHOKKUMAR R>

and my code is


public class HelloWorld
{
  public static void main(String[] args)
  {
    System.out.println("Hello, World!");
  }
}

my sdk location is E:\programfiles\java\jdk1.0.6\bin

my code location is E:\programfiles\java\HelloWorld.java

my os is windows 7



January 16, 2012 at 10:28 PM


Hello Ashok kumar if you are using windows7 then first set your user variable in advance system setting give the variable name- path and the variable value- C:\Program Files\Java\jdk1.6.0_23\bin; if you are install your java in C drive

after that you set your system variable in advance system setting use variable name- classpath variable value-C:\Program Files\Java\jdk1.6.0_23\jre\bin;; please give the semicolon where it is placed... after doing all this things you can run a java program using command line arguments just write java classname arguments










Related Tutorials/Questions & Answers:
command prompt is compilation is not working
command prompt is compilation is not working   Dear java users can anyone help me to run the program in command line prompt i tried by selecting... helloworld through command prompt class not found error and class loader not able
Command Prompt in UI
Command Prompt in UI  Hi, Is there any API or JAR file for running all the windows command prompt commands like dir,echo,ping commands? If any please tell me what is it? Thanks & Regards---Vanchinathan.R
Advertisements
Command Prompt in UI
Command Prompt in UI  Hi One Help... Please go through. I want to develop like that using jsp/javascript but nothing is striking in mind... Please give some suggestions to design first Thanks in advance---- Vanchinathan.R
run command prompt from jsp program
run command prompt from jsp program  Hi.... Is it possible to run a command prompt from jsp? If possible please help me with some code... Thanks & Regards vanchinathan.R
How to connect to MySQL from command prompt?
How to connect to MySQL from command prompt? This video tutorial walks you through the steps to connect to MySQL from command prompt in Windows machine... to the command prompt and typing the “mysql <with arguments>&rdquo
Prompt
into methods in the method asking for the input it uses a prompt command...) { System.out.print(**prompt** + ' '); return numberOfGrades } I don't undersant the prompt part
Video Tutorial: How to create a database in MySQL using Command prompt?
How to create a database in MySQL using Command prompt MySQL is an Operation... is the video tutorial of "How to create database in MySQL using command prompt... command prompt. To create a database we need to use 'create database name
This Query is no working in sql developer it is giving Ora-0933 exception SQL command not properly ended exception
This Query is no working in sql developer it is giving Ora-0933 exception SQL command not properly ended exception  SELECT * from employees ORDER BY first_name limit 0,10;   Hi Friend, Please clarify your problem
prompt using
prompt using  I want examples to use prompt and how to move the item from the prompt to a cell in a table. thank you
using prompt
using prompt  how to use prompt
javascript for prompt - JSP-Servlet
javascript for prompt  Dear sir, I have used prompt() for taking a reason while deleting using java script its working fine but prompt was coming at the top left so i want that prompt should come at middle so how to do
javascript for prompt - JSP-Servlet
javascript for prompt  Dear Sir, I am using a prompt() for taking a reason for delete.I used your code,its working fine .but i am validating a prompt contains any special character or what.If contains a alert message has
What is a prompt box?
What is a prompt box?  What is a prompt box
javascript prompt alert
javascript prompt alert   Sending a prompt alert using a JavaScript function
javservlet compilation error - Servlet Interview Questions
effects current command prompt u have exit current cmd prompt and strat fresh cmd prompt this will slove your problem  Hi Friend, Close your command...javservlet compilation error  hello sir I set the classpath
javascript for prompt - JSP-Servlet
javascript for prompt  Dear sir, I am using prompt()for taking a reason from vendor . var reason=prompt('Reason for deleting:',''); Then i... an object ,so how to remove this script error.And also this prompt is coming
How to prompt user
How to prompt user  Dear Sir, I'm a new student, a beginner in Java. Pls help to write program as below :- a)to prompt user to input 2 integers, the 1st number entered as Digit 1 and 2nd number as Digit 2. b)Display the value
Hibernate compilation - Hibernate
Hibernate compilation  please explain how to compile and run Hibernate at command prompt ( in dos) with sample example
Compute command
Compute command  hello, What is compute command?   hii, samar Compute command control computations on subsets created by the BREAK command
Prompt for a password when deleting a data
Prompt for a password when deleting a data  I am using netbeans and mysql. i have added a username and password. i have a set of data in the database. so when deleting a data it should prompt for the password and if the password
Print command
Print command  Can I use System.out.println command in Struts form bean or Struts action class. I am using Struts 1.3.8 but when I write this command...;You can use System.out.println command in Strut Action Class. The message written
java compilation error - JSP-Servlet
your command prompt and compile your servlet and then restart the tomcat...java compilation error  sir ,i have jdk1.6.0_01 and textpad installed .I have also set classpath and path.But stil on compiling my servlet programs
java compilation error - Servlet Interview Questions
:\program file\java\jdk1.6.0). You can either set this from the command prompt...java compilation error  when i compile my servlet java file i get the compilation error as import java.servlet.* not found  servlet
UITapgesturerecognizer not working
UITapgesturerecognizer not working  uitapgesturerecognizer not working
javascript for textbox or prompt using servlet - JSP-Servlet
javascript for textbox or prompt using servlet  Dear sir, I am using a prompt(),when a delete is confirmed,its working fine ,but when a prompt is closed or cancel ,i have to remain in the same page but here it is going
javascript for textbox or prompt using servlet - JSP-Servlet
javascript for textbox or prompt using servlet  Dear sir I am writing script in servlet,so prompt() is not working here so please help me...\"){"); out.println(" var reason=prompt('Reason for deleting
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot exist ( though i imported it) & cant recognise SUCCESS etc symbol.i think i
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot exist ( though i imported it) & cant recognise SUCCESS etc symbol.i think i
Java compilation error - Java Beginners
Java compilation error  Hello, i am getting an error while running simple core java program on command prompt.java is installed on my pc... dos prompt if it is running and open the dos prompt once again. Read more
compilation fail
compilation fail  package jsptube.tutorials.servletexample; import javax.servlet.GenericServlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import java.io.IOException; import
htpasswd working
htpasswd working   hii, What does htpasswd do?   hello, htpasswd creates a new user in a specified group, and asks to specify a password for that user

Ads

Advertisement