It's not a secret anymore!*
The moose likes Beginning Java and the fly likes How to execute through java class command prompt(windows7) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to execute through java class command prompt(windows7)" Watch "How to execute through java class command prompt(windows7)" New topic
Author

How to execute through java class command prompt(windows7)

srihari miriyala
Greenhorn

Joined: May 16, 2012
Posts: 16
hi guys..

when executing java class through net beans.. i am getting required output...(in attachment 2 - netBeans.png)..

while executing same class through command prompt (Windows) i am getting some errors...(in attachment 1 - commandPrompt.png)

please help in this.


[Thumbnail for netBeans.png]

[Thumbnail for commandPrompt.png]

srihari miriyala
Greenhorn

Joined: May 16, 2012
Posts: 16
i found, how to compile. but i don't know how to run this...


[Thumbnail for complie.png]

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36507
    
  16
Your screenshots are difficult to read; please post the text of the error messages.
srihari miriyala
Greenhorn

Joined: May 16, 2012
Posts: 16
hi..

i successfully compiled the java program with ..

if i am using like



but i don't know how to run the program in windows command prompt....

my program uses sqlitejdbc-v056.jar(driver) and SQLite_DAL.jar(it returns connectionstring .. etc..)... then how to run program...

sqlitejdbc-v056.jar(driver) and SQLite_DAL.jar(it returns connectionstring .. etc..) both are in same directory "D:\Libraries\"

and JavaApplication_KMF_Test.class is in "C:\Users\Srihari\Documents\NetBeansProjects\JavaApplication_KMF_Test\src\JavaApplication_KMF_Test.class"
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36507
    
  16
Changing to and from NetBeans can cause confusion. IDEs tend to put all their source files in a src folder. If you compiled the KMF class inside the src folder, then the .class file will probably be inside another folder, corresponding to its package structure. Have you got a lot of classes? What packages are they in? Is the .class file actually in that directory?
Can you execute it with java -classpath D:\Libraries\SQLite_DAL.jar packageName.JavaApplication_KMF_Test ?
It might be worthwhile posting the folder structure, if you can fit it onto the page.
srihari miriyala
Greenhorn

Joined: May 16, 2012
Posts: 16
thanks for the replay...

i've following package.




i created a jar file using

sqlitejdbc-v056.jar(driver) and SQLite_DAL.jar(it returns connectionstring .. etc..) both are in same directory "D:\Libraries\"

and added as a library for another project(JavaApplication_KMF_Test)

JavaApplication_KMF_Test project contains following class



path for above class was "C:\Users\Srihari\Documents\NetBeansProjects\JavaApplication_KMF_Test\src\"


now i am trying to execute from windows command prompt

Compiling



succeed...

Run



now i am getting




please help me..









Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36507
    
  16
Which folder is that JavaApplication_KMF_Test.class file in? That would appear to be the first problem, that the .class isn’t where you think it is.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to execute through java class command prompt(windows7)
 
Similar Threads
NoClassDefFoundError
Trouble in executing sqlldr through java
URGENT - runtime.exec command doesn't execute on unix
HibernateException: JDBC Driver class not found: oracle.jdbc.driver.OracleDriver
mail.jar..