Solved

call outside program

Posted on 2011-02-14
2
463 Views
Last Modified: 2012-06-21
How to call a outside program.

I had a executable jar file... which upon calling executes a program
I want to execute that jar file from my struts java action class...

is it possible to call an outside jar file...

i heard shell api in java is used for calling such outside programs...

how to use that shell api.. can anyone provide me an example...

0
Comment
Question by:shragi
  • 2
2 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
Comment Utility
I hope this could be useful:
http://www.java-forums.org/advanced-java/26395-calling-jar-file-within-java-application.html

You can try to call main method of your starting class directly
from your code as you call any other method, if you ensure that your jar is in the classpath

You can also use Runtime.getRuntime().exec("java -jar ...") command like when starting anyothe  executable command ;
make sure that java  is in the PATH and you can provide -classpath in the argument line
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 total points
Comment Utility

In Java 6 you can also probably use Desktop command:
http://stackoverflow.com/questions/4989749/launching-external-programs-with-java

This is anew way though - never tried it myself, don't know if it works on all sysytems and if it is suitable
for server environment
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Convert websphere application server default chained Certificates from 1024 to 2048 keysize or higher size and also you can change signatureAlgorithm . Please make sure Websphere Application Server fixpack 7.0.0.23 or Above. The following steps a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now