?
Solved

How to run a .jar file from C++

Posted on 2003-03-19
4
Medium Priority
?
2,104 Views
Last Modified: 2012-05-04
I have a C++ Application from which i would like to start a .jar file. I tried to use the createprocess function and passed the string as javaw -jar Myfile.jar But it doesnt work that way, eventhough it works for an .exe file. Is there a way to start up my application from C++. Can any body help me with this?...
0
Comment
Question by:balajicre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Accepted Solution

by:
somchaiu earned 160 total points
ID: 8171130
You do not run the jar file. You run javaw.exe, so this should work. However, you have to assign the correct "current directory" for the new process too. Generally, you change to the directory of jar file because launch another process.
0
 
LVL 1

Assisted Solution

by:igor_sk
igor_sk earned 140 total points
ID: 8171570
You should build command line, which includes full path to your javaw.exe, your class path and class that you will run. It should be somthing like this:

C:\jdk1.3.1_02\jre\bin\javaw.exe -cp <your jar file path> <class name>

This will be the command that you will execute from you program using WinExec() Win API function (I guess you use Windows).
0
 

Expert Comment

by:CleanupPing
ID: 9446978
balajicre:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Introduction to Processes
Suggested Courses

777 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