473,698 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using C to call other programs

thatos
105 New Member
I have a java class exe.class I would like to call this program using c.
I tried the following methods none of them seems to work if you know where the problem is please help.
Expand|Select|Wrap|Line Numbers
  1. main(){
    System("java C:/Users/sthato/workspace/NumThe/bin/exe");
    execlp("java","C:/Users/sthato/workspace/NumThe/bin/exe");
    execlp("C:/Program Files/Java/jdk1.6.0_07/bin/java.exe","C:/Users/sthato/workspace/NumThe/bin/exe");
When I run
Expand|Select|Wrap|Line Numbers
  1. java C:/Users/sthato/workspace/NumThe/bin/exe
from command prompt it works.
Apr 13 '09 #1
2 1756
JosAH
11,448 Recognized Expert MVP
@thatos
The name of your class is exe.class, not C:/some/path/to/your/exe.class. Try to use the classpath parameter, i.e:

Expand|Select|Wrap|Line Numbers
  1. system("java -cp C:/Users/sthato/worksapce/NumThe/bin exe");
  2.  
kind regards,

Jos
Apr 13 '09 #2
thatos
105 New Member
I tried that line of code and it works, thank you.
Apr 13 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
3340
by: hokiegal99 | last post by:
A few questions about the following code. How would I "wrap" this in a function, and do I need to? Also, how can I make the code smart enough to realize that when a file has 2 or more bad charcters in it, that the code needs to run until all bad characters are gone? For example, if a file has the name "<bad*mac\file" the program has to run 3 times to get all three bad chars out of the file name. The passes look like this:
3
1846
by: Griff | last post by:
Hi there I'm trying to run some CGI programs under Apache, written in C++, which use the "libmysqlclient" MySQL library. This is all running on Solaris. I build my programs using the following makefile: all: SCM exampleSQL
8
2585
by: Peter Nolan | last post by:
Hi All, I have written some software that performs ETL processing to load data warehouses. Each program accepts a set of parameters and returns 0 or 1 to the win/unix shell to indicate success or failure. Currently it is run as a set of commands that calls each program and then returns the return code and stops if the program has failed. I'm interested in enhancing the product by being able to call these programs from within another C++...
121
10080
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
1
4167
by: Norman Fritag | last post by:
Hi there I have avoided to use active x controls because I thought they are causing more problems then they are doing any good. I a new application I would want to use the tree and list view control in access 2002. Prior to that I like to fine some information or here some feed back from developers who have use active x controls success fully in there application, what their experience was.
5
2803
by: Seong-Kook Shin | last post by:
Hi, I'm reading Steve's "C Programming FAQs" in book version, and have two question regarding to Q11.16 ... Also, a `return' from `main' cannot be expected to work if data local to main might be needed during cleanup. (Finally the two forms are obviously not equivalent in a recursive call to `main'). My questions are
8
2577
by: FS Liu | last post by:
Hi, I am writing ATL Service application (XML Web service) in VS.NET C++. Are there any sample programs that accept XML as input and XML as output in the web service? Thank you very much.
24
6576
by: John | last post by:
I know this is a very fundamental question. I am still quite confused if the program call stack stack should always grows upwards from the bottom, or the opposite, or doesn't matter?? That means the stack pointer should go upwards when there are "push" operations, and stack pointer should go downards when there are "pop" operations?? If this is the case, the address should go upwards (increasing) or downards (decreasing) then? i.e....
5
25226
by: chenthil | last post by:
In my Java program I need to call two DOS batch programs namely call.bat and start.bat. First I need to start the batch program call.bat and once that program is completed, I need to call the other batch file start.bat. The piece of code which I am using is: public static void ExecuteScripts(){ try { \\Start the first batch program call.bat Process p = Runtime.getRuntime().exec("cmd /c start .\\scripts\\call.bat"); ...
4
3164
by: PilotHaz | last post by:
I have currently looked through a couple of the posts on here about Stored Procedures but using this information did not work. Here is what I have done. I am trying to use wild cards for I want to search through my database for specific Programs that have been added to the database from the computer's login script. In my search I want to call a stored procedure to make it easier then making a call each time (and just to use the one that is...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.