all groups > vj# > june 2005 >
You're in the

vj#

group:

How do I import a user defined class into VisualStudio .net J#



How do I import a user defined class into VisualStudio .net J# Tony Johansson
6/9/2005 6:20:27 PM
vj#: Hello Experts!

I'm using Visual Studio .NET with J#.
For example if you compile a java file by using the javac in the command
window(cmd) you get a class file.
One example if you have a java file called Test.java and you compile this
file
from the command window you get a Test.class file.

How to I import this class file Test.class so I can call methods that exist
in that file.
I have tried everything to set the classpath and I have put this classfile
Test.class
at the project folder and at the folder where the exe file is located.
Nothing works.

I have tried from Visual Studio In the "Project" menu "Add existing item..."
Locate the
files and "OK". But this didn't help.

Does anybody know if it's possible to use a class file when you use Visual
Studio .net. How do I do?


//Tony


Re: How do I import a user defined class into VisualStudio .net J# Tony Johansson
6/9/2005 7:24:43 PM

"Tony Johansson" <johansson.andersson@telia.com> skrev i meddelandet
news:LL%pe.26927$d5.178347@newsb.telia.net...
[quoted text, click to view]

I forgot to tell you that the problem that I have is that I get compile
error saying "Cannot find class Test" if the class is called Test.

[quoted text, click to view]

Re: How do I import a user defined class into VisualStudio .net J# Lars-Inge Tønnessen [VJ# MVP]
6/9/2005 9:20:25 PM
Hi,

You can not import java binary code into J#. Please recompile the java
source files into a J#.NET library, or use the jbimpl tool to make a DLL
library from the java byte code files. When you have the DLL library, add a
reference to it in the Visual Studio IDE.

c:\> jbimp.exe /target:library /out:MyLib.dll *.class

"Add a reference" to "MyLib.dll" in Visual Studio under the project menu.


We don't have the classpath in J#.NET. Please put the DLL in a path where
your app can find it (if you compile J# from the command prompt). Visual
Studio will do this for you when you add a reference to it.


Regards,
Lars-Inge Tønnessen

Re: How do I import a user defined class into VisualStudio .net J# Lars-Inge Tønnessen [VJ# MVP]
6/11/2005 12:00:00 AM

[quoted text, click to view]


Does the class belong to a namespace/package?

Eg:
myNameSpace.Test on = new myNameSpace.test();


Regards,
Lars-Inge Tønnessen

AddThis Social Bookmark Button