Solved

using a java class in a C++ application

Posted on 1998-09-04
3
159 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
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 60 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

932 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