Java程序的C包装器? [英] C wrapper for Java program?

查看:61
本文介绍了Java程序的C包装器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个C包装器来运行Java程序。我需要

用Java运行时,我的应用程序和一个C启动程序分发一张CD

程序。我把C包装程序,我的java应用程序和运行时

目录放在同一目录中。它将在MS XP下运行,或者可能是
Vista。我正在使用MS Visual C ++ Express 2005编译器,我使用_execl和_spawnl函数尝试了
。这些都给我断言

错误和文件未找到错误。路径有一些问题。

_execl()和_spawnl()是否需要文件的绝对路径?任何想法

或指示将不胜感激。


谢谢,


-


Knute Johnson

email s / nospam / knute /

I''m trying to write a C wrapper to run a Java program. I need to
distribute a CD with the Java runtime, my application and a C startup
program. I''ve put the C wrapper program, my java app and the runtime
directories in the same directory. It will run under MS XP or maybe
Vista. I''m using MS Visual C++ Express 2005 for a compiler and I tried
using the _execl and _spawnl functions. These all give me assertion
errors and file not found errors. There is some issue with the path.
Do _execl() and _spawnl() need absolute paths to the files? Any ideas
or directions would be greatly appreciated.

Thanks,

--

Knute Johnson
email s/nospam/knute/

推荐答案

Knute Johnson写道:
Knute Johnson wrote:

我正在尝试编写一个C包装器来运行Java程序。 [..]
I''m trying to write a C wrapper to run a Java program. [..]



你可能已经停在那里了。在comp.lang.C ++中,C和Java都没有主题

。你看,加号加号是不同的。


现在,如果您的问题是关于编译器或特定于OS的

函数,请RTFM或在新闻组询问这些是什么

主题。


V

-

请删除大写''A'当通过电子邮件回复

我没有回复最热门的回复,请不要问

You could''ve stopped right there. Neither C nor Java are on topic
in comp.lang.C++. You see, the "plus-plus" is the difference.

Now, if your question is about the compiler or the OS-specific
functions, please RTFM or ask in the newsgroup where those are
topical.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


Victor Bazarov写道:
Victor Bazarov wrote:

Knute Johnson写道:
Knute Johnson wrote:

>我正在尝试编写一个C包装器来运行一个Java程序。 [..]
>I''m trying to write a C wrapper to run a Java program. [..]



你可能已经在那里停了下来。在comp.lang.C ++中,C和Java都没有主题

。你看,加号加号是不同的。


现在,如果您的问题是关于编译器或特定于OS的

函数,请RTFM或在新闻组询问这些是什么

主题。


V


You could''ve stopped right there. Neither C nor Java are on topic
in comp.lang.C++. You see, the "plus-plus" is the difference.

Now, if your question is about the compiler or the OS-specific
functions, please RTFM or ask in the newsgroup where those are
topical.

V



Victor你是当地的PITA吗?每个新闻组都有一个。你没看到我使用的是C ++编译器来编写程序吗?至于
我知道C仍然是C ++的一个子集。如果你不想,那就去沙滩。


每个程序必须在某些操作系统上运行,如果要问如何编写包装器
带有C ++编译器的
程序不是C ++问题然后我会悄悄地

消失。描述我的环境只是为了提供我的问题所需的信息

。我很乐意接受一个''纯''C ++

解决方案。非常感谢任何帮助。


谢谢,

-


Knute Johnson

email s / nospam / knute /

Victor are you the local PITA? There is one in every newsgroup. Did
you not see I was using a C++ compiler to write the program. As far as
I know C is still a subset of C++. Go pound sand if you don''t want to
be helpful.

Every program has to run on some OS and if asking how to write a wrapper
program with a C++ compiler isn''t a C++ question then I will quietly
go away. Describing my environment was only to provide information that
might be necessary to my problem. I will happily accept a ''pure'' C++
solution. Any assistance is greatly appreciated.

Thankyou,

--

Knute Johnson
email s/nospam/knute/


Knute Johnson写道:
Knute Johnson wrote:

Victor Bazarov写道:
Victor Bazarov wrote:

> Knute Johnson写道:
>Knute Johnson wrote:

>>我正在尝试编写一个C包装器来运行Java程序。 [..]
>>I''m trying to write a C wrapper to run a Java program. [..]


你可能已经在那里停了下来。在comp.lang.C ++中,C和Java都没有主题。你看,加号加号是不同的。

现在,如果您的问题是关于编译器或特定于操作系统的功能,请RTFM或在新闻组中询问那些是哪些主题。

V


You could''ve stopped right there. Neither C nor Java are on topic
in comp.lang.C++. You see, the "plus-plus" is the difference.

Now, if your question is about the compiler or the OS-specific
functions, please RTFM or ask in the newsgroup where those are
topical.

V



Victor你是当地的PITA吗?


Victor are you the local PITA?



不。他是一名过去帮助过很多人的常客。

Nope. He is a regular who has helped many people in the past.


每个新闻组都有一个。你没有看到我使用C ++

编译器来编写程序。
There is one in every newsgroup. Did you not see I was using a C++
compiler to write the program.



你使用的编译器与你的问题是否是热门话题无关。

What compiler you use is irrelevant for whether your question is topical.


据我所知C仍然是C ++的一个子集。
As far as I know C is still a subset of C++.



Nit:事实并非如此。有许多合法的C程序在C ++中是非法的,并且许多合法的C程序恰好也是合法的C ++,但在解释为C ++程序时具有不同的
行为。但是,C和C ++之间存在非空的
交叉。

Nit: It is not. There are many legal C programs that are illegal in C++ and
many legal C programs that happen to be legal C++, too, but have different
behavior when interpreted as C++ programs. There is, however, a non-empty
intersection of C and C++.


如果你不想要很有帮助。


每个程序都必须在某些操作系统上运行,如果询问如何编写包装器,那么带有C ++编译器的
程序不是C ++问题然后我会悄悄地将b $ b消失。描述我的环境只是为了提供我的问题所需的信息

。我很乐意接受一个''纯''C ++

解决方案。非常感谢任何帮助。
Go pound sand if you don''t want to be helpful.

Every program has to run on some OS and if asking how to write a wrapper
program with a C++ compiler isn''t a C++ question then I will quietly
go away. Describing my environment was only to provide information that
might be necessary to my problem. I will happily accept a ''pure'' C++
solution. Any assistance is greatly appreciated.



您的具体问题是:

Your specific question was:


我正在使用MS Visual C ++ Express 2005编译器我使用_execl和_spawnl函数尝试了

。这些都给我断言

错误和文件未找到错误。路径有一些问题。

_execl()和_spawnl()是否需要文件的绝对路径?
I''m using MS Visual C++ Express 2005 for a compiler and I tried
using the _execl and _spawnl functions. These all give me assertion
errors and file not found errors. There is some issue with the path.
Do _execl() and _spawnl() need absolute paths to the files?



在我的C ++标准的pdf文件中搜索没有找到_execl()或者

_spawnl(),我也做了没有找到它通过引用纳入C

标准。这几乎就是你的问题的扩展范围

在这个论坛中回答。所以最后,维克多可能是对的,并且你可能会在_execl()和_spawnl()已知的地方更好。


另一方面手,你可以尝试一下绝对路径名称,看看

是否可以解决你的问题。


最好


Kai-Uwe Bux

A search in my pdf-file of the C++ standard did not find _execl() nor
_spawnl(), and I also did not find it incorporated by reference from the C
standard. This pretty much is is the extend to which your question can be
answered topically in this forum. So in the end, Victor might be right and
you might be better off someplace where _execl() and _spawnl() are known.

On the other hand, you could just give absolute path names a try and see
whether that cures your problem.

Best

Kai-Uwe Bux


这篇关于Java程序的C包装器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆