?
Solved

using a java class in a C++ application

Posted on 1998-09-04
3
Medium Priority
?
165 Views
Last Modified: 2010-04-02
Hi,
I have created a java class and now I'd like to use it in a C++ application. Do you know how to do this?
Thanks
0
Comment
Question by:stef3
[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
3 Comments
 

Author Comment

by:stef3
ID: 1172044
Edited text of question
0
 
LVL 8

Expert Comment

by:Answers2000
ID: 1172045
Crude solution if your Java code can run in an applet:

You need IE installed on the same PC.

     1. Use the Web Browser control (SHDOCVW.DLL), insert this into your form.
     2. Make a dummy HTML page which references the applet (just like if you were putting the applet on the web).  Save this as a file.
     3. Use the Navigate function in the Web Browser control to bring up the dummy HTML page.  [it can navigate to local files as well as web sites]

     Incidentally the dummy HTML file can either be distributed with your app, be on a web site somewhere or you can create a local file using the C++ file functions (HTML
     pages are just ASCII text after all)
0
 

Accepted Solution

by:
cheehong earned 180 total points
ID: 1172046
I would assume that your java classes are not applet.  A neater way will be to use JNI. (Java Native Interface)

I would not quote the example here.  But you can find out further details from the article titled:
Merging Java and Win32: A new way to develop Windows applications
Learn how to write Win32 applications in Java instead of C++ -- and save yourself some time and effort!

from JavaWorld at http://www.javaworld.com/javaworld/jw-07-1998/jw-07-java-win32.html

Enjoy! 8)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

764 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