File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes .class file execution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark ".class file execution" Watch ".class file execution" New topic
Author

.class file execution

Ram Sudheer Mandava
Greenhorn

Joined: Aug 04, 2010
Posts: 22
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

Joined: Sep 08, 2007
Posts: 3068
    
  33

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.


Mohamed Sanaulla | My Blog
Ram Sudheer Mandava
Greenhorn

Joined: Aug 04, 2010
Posts: 22
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

Joined: Sep 08, 2007
Posts: 3068
    
  33

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

Joined: Dec 22, 2009
Posts: 88

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>


SCJP 91%, SCWCD 97%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: .class file execution