HighTechTalks DotNet Forums  

error when import assembly compiled with jvc.exe

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss error when import assembly compiled with jvc.exe in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Radu Mirescu
 
Posts: n/a

Default error when import assembly compiled with jvc.exe - 03-21-2005 , 04:09 AM






Hi!
I've made a simplest java application. An empty class Test.java stored in
package "saa.test". I've compiled it using jvc.exe /target:library
/out:Test.dll.
It was done fine. The Test.dll was created without errors.
But when I tried to insert a reference to the Test.dll assembly an error
message occured telling me that it is not a valid one.
If I compile the Test.java using the .NET IDE this error does not occurs any
more.

Since I want to use the command line compiler in batch mode,
can anyone help me to solve this problem?

Thanks,

Radu

Reply With Quote
  #2  
Old   
Radu Mirescu
 
Posts: n/a

Default Re: error when import assembly compiled with jvc.exe - 03-28-2005 , 06:09 AM






I responded bellow at some point :

"Lars-Inge Tønnessen [VJ# MVP]" wrote:

Quote:
This is working for me. Here is how:



Here is my library file "saa.java" (this is J#)

package saa.test;

public class test
{

public test()
{
}

public void me()
{
System.out.println("hi");
}
}

This is how I compiled it:

saa\test>vjc *.java /target:library /out:Test.dll
Microsoft (R) Visual J# .NET Compiler version 7.10.3077.0
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corp 2000-2002. All rights reserved.

saa\test


In the client I add a reference to the dll file, and do the calls. Here is
my client
I suppose you have created the client using a new J# Project.
I have not tried this. I tried to link the library in a client written in
VB, in a VB.NET project (since the .dll does not depend on language) and
doesn't work.
This is working for you too?

I will try using a J# project to see if it is work or not.

Thanks,

Radu

P.S. Could be what's happened to me a bug of an older Visual Studio version?
It seems I have an older version of Visual Studio than you ...

Quote:
package ConsoleApplication1;

public class Class1
{
public Class1()
{
saa.test.test t = new saa.test.test();
t.me();
}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
new Class1();
}
}

The client output:

\bin\Debug>ConsoleApplication1.exe
hi



Regards,
Lars-Inge Tønnessen




Reply With Quote
  #3  
Old   
Radu Mirescu
 
Posts: n/a

Default Re: error when import assembly compiled with jvc.exe - 03-28-2005 , 07:07 AM



Sorry,
I think I was not clear enough.
I managed to make a reference and include the .dll in an .exe using command
line tools, like you.
But I cannot include the .dll as reference in a VB.NET Project (an error
occurs).
This is usefull not just for compilation (which can be solved using command
line tools) but either for IntelliSense, you know.
If you already tried, using a VB.NET project it seams that it was a still
unknown problem on my machine ...
If you don't tried yet please try to add a reference, in a VB.NET to the
..dll (which was compiled only with the command line tool and has no other
files but .java files in it).

Thanks for all,

Radu


"Lars-Inge Tønnessen [VJ# MVP]" wrote:

Quote:
It's working in Visual Studio .NET 2002 / .NET 1.0 too.


F:\Informatikk\WebHjelp\VJSharp\saa\test>vjc *.java /target:library
/out:Test2002.dll
Microsoft (R) Visual J# .NET Compiler version 1.0.4205
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corp 2000-2001. All rights reserved.


F:\Informatikk\WebHjelp\VJSharp\saa\test


The VB.NET code (Module1.vb file)

Module Module1

Sub Main()
Dim test As New saa.test.test()
test.me()
End Sub

End Module




F:\Informatikk\WebHjelp\VJSharp\saa\VB2002_client\ bin>vbc *.vb /out:me.exe
/target:exe /reference:Test2002.dll

Microsoft (R) Visual Basic .NET Compiler version 7.00.9951
for Microsoft (R) .NET Framework version 1.00.3705.6018
Copyright (C) Microsoft Corporation 1987-2001. All rights reserved.


F:\Informatikk\WebHjelp\VJSharp\saa\VB2002_client\ bin>me.exe
hi

F:\Informatikk\WebHjelp\VJSharp\saa\VB2002_client\ bin>dir
Volume in drive F is MAXTOR
Volume Serial Number is 043D-0159

Directory of F:\Informatikk\WebHjelp\VJSharp\saa\VB2002_client\ bin

28.03.2005 13:50 <DIR> .
28.03.2005 13:50 <DIR> ..
28.03.2005 13:50 3 072 me.exe
28.03.2005 13:39 121 Module1.vb
28.03.2005 13:38 20 480 Test2002.dll
3 File(s) 23 673 bytes
2 Dir(s) 198 406 107 136 bytes free

F:\Informatikk\WebHjelp\VJSharp\saa\VB2002_client\ bin



Regards,
Lars-Inge Tønnessen




Reply With Quote
  #4  
Old   
Radu Mirescu
 
Posts: n/a

Default Re: error when import assembly compiled with jvc.exe - 03-30-2005 , 10:43 AM



Please give me your email address to send you some files in order to document
my problem.

Thanks,

Radu

"Lars-Inge Tønnessen [VJ# MVP]" wrote:

Quote:
I managed to make a reference and include the .dll in an .exe using
command
line tools, like you.

Cool.


But I cannot include the .dll as reference in a VB.NET Project (an error
occurs).
This is usefull not just for compilation (which can be solved using
command
line tools) but either for IntelliSense, you know.
If you already tried, using a VB.NET project it seams that it was a still
unknown problem on my machine ...


It's working for me in VS2002.NET 1.0 with the IntelliSense too.

Command line, Visual Studio 2002/.NET 1.0 and Visual Studio 2003 / :NET 1.1
is working for me.


If you don't tried yet please try to add a reference, in a VB.NET to the
.dll (which was compiled only with the command line tool and has no other
files but .java files in it).

the DLL only has the compiled version of the "saa.java" file and it was
compiled with the command line tool.


What kind of VB.NET project do you use? (I'm using an exe application)

What does the error say?



Regards,
Lars-Inge Tønnessen

(Please visit the new J# forum at
http://forums.microsoft.com/forums/S...spx?ForumID=28 )




Reply With Quote
  #5  
Old   
Radu Mirescu
 
Posts: n/a

Default Re: error when import assembly compiled with jvc.exe - 04-01-2005 , 12:51 AM



I've tried the following example

----- file root\saa\test\Test01.java ----

package saa.test;

public class Test01 {
private String msg;
public Test01(String _msg){
msg = _msg;
}
public String getMessage()
{
return msg;
}
}

----- end file

----- file root\Form2.vb

imports saa.test

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Name = "Form1"
Me.Text = "Form1"

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim t1 As Test01

t1 = New Test01("Un mesaj din java!")
MsgBox(t1.getMessage())
End Sub
End Class

---- end file

---- file root\Module1.vb

Module Module1
Public Sub main()
Dim f1 As Form1
f1 = New Form1
f1.Show()
End Sub
End Module

---- end file

----- file root\test.bat ----

vjc /recurse:saa\*.java /out:Test2.dll /target:library
vbc *.vb /target:exe /reference:Test2.dll /out:testVb2.exe
testVb2.exe

----- end file

And it works!

But when I want to import the library Test2.dll in another VB.Net project
an error message occurs:

"A reference to ...\root\Test2.dll could not be added. This is not a valid
assembly or COM component. Only assemblies with extension 'dll' and COM
components can be referenced. Please make sure that the file is accessible,
and that it is a valid assembly or COM component."

I think the .dll was not used by any other program, to lock it, for example.
So I cannot explain myself why it is occured.

Thanks for your patience,

Radu


"Lars-Inge Tønnessen [VJ# MVP]" wrote:

Quote:
Please zip them and post them here. It should only take a few kb's. To keep
the size low, don't include any binary compiled code.

Or you can upload the code on the new J# forum.

http://forums.microsoft.com/forums/S...spx?ForumID=28


( Sorry I can't give you my e-mail address directly in a news forum. I get a
huge number of unwanted e-mails every day. )


Regards,
Lars-Inge Tønnessen

(Please visit the new J# forum at
http://forums.microsoft.com/forums/S...spx?ForumID=28 )




Reply With Quote
  #6  
Old   
Radu Mirescu
 
Posts: n/a

Default Re: error when import assembly compiled with jvc.exe - 04-04-2005 , 01:27 AM



I have Visual Studio 2003 ...
But I think I had previous a Microsoft .NET Framework on an earlier version
(because that I told you that maybe I have an earlier version).
Maybe when I installed the Visual Studio 2003 there was some files from the
older version which remains ?! I don't know ...
I will manage to reinstall it from scratch ...

Thanks for your help,

Radu

"Lars-Inge Tønnessen [VJ# MVP]" wrote:

Quote:
Hi Radu,

Your application is working 100% on my computer using Visual Studio
2002/.NET 1.0
I tried all combinations. Command linje compiler and Visual Studio
compilations.

Regards,
Lars-Inge Tønnessen




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.