• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.class file execution

 
Ram Sudheer Mandava
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I'm supporting one java application. In that Windows system we have one batch file

example.bat

java -classpath "E:\Data\Scripts_in\Pre-Processing;E:\Data\Scripts_In\Pre-Processing\log4j-1.2.15.jar" HelloWorld


the above line is the content in the batch file. Now my question is How can i run that batch file in another windows system?
anyone please help me on this
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be an option to pass the path of the jar or class file as a command line argument.

And this is not specific to JSPs though.
 
Ram Sudheer Mandava
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I didn't get what you are saying? and log4j.jar file and .class file are in same directory. When run the batch file, .class file is not executing.
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You earlier said:
Ram Sudheer Mandava wrote:
Now my question is How can i run that batch file in another windows system?

As the location of your jar and class files will not be same in different systems, I suggested you take the input for your -classpath as an command line argument to the bat file.


 
Shashank Ag
Ranch Hand
Posts: 88
Java Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do not need to give absolute path of jar in batch file, relative path can also do.
I'll suggest to package your application as:



in batch file write:
java -cp ../lib/log4j.jar;../lib/<your app>.jar;. java <class name>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic