Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to execute through java class command prompt(windows7)

 
srihari miriyala
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
netBeans.png
[Thumbnail for netBeans.png]
commandPrompt.png
[Thumbnail for commandPrompt.png]
 
srihari miriyala
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found, how to compile. but i don't know how to run this...
complie.png
[Thumbnail for complie.png]
 
Campbell Ritchie
Sheriff
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your screenshots are difficult to read; please post the text of the error messages.
 
srihari miriyala
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 49447
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic