Home » Eclipse Projects » Standard Widget Toolkit (SWT) » swt.lib ??
swt.lib ?? [message #446636] |
Tue, 30 November 2004 13:48 |
Eclipse User |
|
|
|
Originally posted by: camilla.orlandi.gmail.com
hi everybody
I have Eclipse 3.0, gcj & gcc 3.4 on windows 2K.
I tried to compile my swt class with gcj and works, but I can't manage to
link the file so I have not an exe at the end of the compilation. I have
<classname>.o, obviously.
the fact is that I need a swt.lib file to get the linking, I suppose, but
I can't find the way to get it.
I tried to compile the swt.jar from the prompt but had no success.
any idea??
|
|
|
Re: swt.lib ?? [message #446704 is a reply to message #446636] |
Wed, 01 December 2004 02:26 |
Charlie Surface Messages: 40 Registered: July 2009 |
Member |
|
|
I've never used gcj, but I'll take a guess about the problem. Since SWT
has native code, you will need to link your executable with the library
that contains the native code. This is usually done by passing a .lib
file to the compiler. This file can be generated when the swt dll is
built (swt-win32-XXXX.dll). However, it is probably not distributed by
the SWT team, because normal users have no use for it.
That being said, I think you will have to try to rebuild the swt dll
yourself. The build might already generate a .lib for you. If not, you
will have to modify the linker options yourself to generate it.
Charlie
Camilla wrote:
> hi everybody
> I have Eclipse 3.0, gcj & gcc 3.4 on windows 2K.
> I tried to compile my swt class with gcj and works, but I can't manage
> to link the file so I have not an exe at the end of the compilation. I
> have <classname>.o, obviously.
> the fact is that I need a swt.lib file to get the linking, I suppose,
> but I can't find the way to get it.
> I tried to compile the swt.jar from the prompt but had no success.
> any idea??
>
|
|
|
Re: swt.lib ?? [message #446705 is a reply to message #446704] |
Wed, 01 December 2004 03:20 |
Charlie Surface Messages: 40 Registered: July 2009 |
Member |
|
|
After poking around the gcj site a bit, I think my comment may have been
incorrect. It looks like you can place the JNI library on the command
line for linking. You were probably asking about how to compile all of
the SWT java files. Can't help you there.
Sorry for any confusion :)
Charlie
Charlie Surface wrote:
> I've never used gcj, but I'll take a guess about the problem. Since SWT
> has native code, you will need to link your executable with the library
> that contains the native code. This is usually done by passing a .lib
> file to the compiler. This file can be generated when the swt dll is
> built (swt-win32-XXXX.dll). However, it is probably not distributed by
> the SWT team, because normal users have no use for it.
>
> That being said, I think you will have to try to rebuild the swt dll
> yourself. The build might already generate a .lib for you. If not, you
> will have to modify the linker options yourself to generate it.
>
> Charlie
>
>
> Camilla wrote:
>
>> hi everybody
>> I have Eclipse 3.0, gcj & gcc 3.4 on windows 2K.
>> I tried to compile my swt class with gcj and works, but I can't manage
>> to link the file so I have not an exe at the end of the compilation. I
>> have <classname>.o, obviously.
>> the fact is that I need a swt.lib file to get the linking, I suppose,
>> but I can't find the way to get it.
>> I tried to compile the swt.jar from the prompt but had no success.
>> any idea??
>>
|
|
|
Re: swt.lib ?? [message #446709 is a reply to message #446705] |
Wed, 01 December 2004 09:34 |
Eclipse User |
|
|
|
Originally posted by: melko.gmx.at
try this:
make an build.bat with the following code and then it should make an exe
out of your java files easily.
@echo off
SETLOCAL
echo Name of the Main-Class...
set MAIN=Main
echo set the evironment-paths...
PATH C:\gcc\bin;C:\gcc\i686-pc-mingw32\bin;%PATH%
set SWT_DIR=C:\gcc\swt
>>>in this SWT_DIR you have the *.dll of SWT and the swt.jar
echo making dir...
if exist bin rmdir /S /Q bin
if exist obj rmdir /S /Q obj
if exist include rmdir /S /Q include
mkdir bin
cd bin
mkdir resources
cd ..
mkdir obj
mkdir include
echo Compiling to JAVA-Bytecode...
gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin src\com\test\gui\*.java
gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin src\com\test\gui\dialog\*.java
gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin src\com\test\gui\functions\*.java
>>> here you set the path of your java files?! So it is your workspace!
echo make an *.jar archive...
xcopy /Q src\resources\*.* .\bin\resources >>>copy the ressources, if you
have
cd bin
jar cf %MAIN%.jar .\com\test\gui\*.class .\com\test\gui\dialog\*.class
\com\test\gui\functions\*.class .\resources\*.*
move %MAIN%.jar ..\include
cd ..
echo make an object...
gcj --classpath=obj;bin;%SWT_DIR%\swt.jar -fjni -g0 -Os -c
include\%MAIN%.jar -o obj\%MAIN%.o
>>> here you set the swt.jar into the exe plus the now generated main.jar
echo makes library...
cd obj
ar -crs lib%MAIN%.a *.o
move lib%MAIN%.a ..\include
cd ..
echo compiling the EXE-File...
gcj -mwindows --main=com.test.gui.%MAIN% -fjni -g0 -Os -s -o %MAIN%.exe
obj\*.o include\*.a -L%SWT_DIR% -lswt
echo give a name to the EXE...
if exist Test.exe del Test.exe
ren %MAIN%.exe Test.exe
echo.
echo Finished!
ENDLOCAL
pause
I hope I could help!
nice greatings from austria.
PS: You should delete in the source code the text that I have added with
>>> starting!!! Thanks
|
|
| |
Re: swt.lib ?? [message #446712 is a reply to message #446710] |
Wed, 01 December 2004 10:16 |
Eclipse User |
|
|
|
Originally posted by: melko.gmx.at
I dont understand what you mean, but if you make an EXE out of your JAVA
files with this gcj-compiler you need no extra DLLs or JAVA runtime
installed or something else. What you need is only one DLL that should be
with the EXE together and it is the "swt-win32-3063.dll" !! So your
Program consists only of an EXE-File and a single DLL?!?
Nice day.
Konstantin Scheglov wrote:
> melko <melko@gmx.at> wrote:
> BTW, do you know, how to link SWT DLL directly in EXE ?
> I need to have single EXE, without additional DLL's.
> And I am afraid that this is impossible. :-(
>> try this:
>> make an build.bat with the following code and then it should make an exe
>> out of your java files easily.
>> @echo off
>> SETLOCAL
>> echo Name of the Main-Class...
>> set MAIN=Main
>> echo set the evironment-paths...
>> PATH C:gccbin;C:gcci686-pc-mingw32bin;%PATH%
>> set SWT_DIR=C:gccswt
>>>>>in this SWT_DIR you have the *.dll of SWT and the swt.jar
>> echo making dir...
>> if exist bin rmdir /S /Q bin
>> if exist obj rmdir /S /Q obj
>> if exist include rmdir /S /Q include
>> mkdir bin
>> cd bin
>> mkdir resources
>> cd ..
>> mkdir obj
>> mkdir include
>> echo Compiling to JAVA-Bytecode...
>> gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin srccomtestgui*.java
>> gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin srccomtestguidialog*.java
>> gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin srccomtestguifunctions*.java
>>>>> here you set the path of your java files?! So it is your workspace!
>> echo make an *.jar archive...
>> xcopy /Q srcresources*.* .binresources >>>copy the ressources, if you
>> have
>> cd bin
>> jar cf %MAIN%.jar .comtestgui*.class .comtestguidialog*.class
>> comtestguifunctions*.class .resources*.*
>> move %MAIN%.jar ..include
>> cd ..
>> echo make an object...
>> gcj --classpath=obj;bin;%SWT_DIR%swt.jar -fjni -g0 -Os -c
>> include%MAIN%.jar -o obj%MAIN%.o
>>>>> here you set the swt.jar into the exe plus the now generated main.jar
>> echo makes library...
>> cd obj
>> ar -crs lib%MAIN%.a *.o
>> move lib%MAIN%.a ..include
>> cd ..
>> echo compiling the EXE-File...
>> gcj -mwindows --main=com.test.gui.%MAIN% -fjni -g0 -Os -s -o %MAIN%.exe
>> obj*.o include*.a -L%SWT_DIR% -lswt
>> echo give a name to the EXE...
>> if exist Test.exe del Test.exe
>> ren %MAIN%.exe Test.exe
>> echo.
>> echo Finished!
>> ENDLOCAL
>> pause
>> I hope I could help!
>> nice greatings from austria.
>> PS: You should delete in the source code the text that I have added with
>>>>> starting!!! Thanks
|
|
|
Re: swt.lib ?? [message #446714 is a reply to message #446712] |
Wed, 01 December 2004 13:20 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
melko writes:
> I dont understand what you mean, but if you make an EXE out of your JAVA
> files with this gcj-compiler you need no extra DLLs or JAVA runtime
> installed or something else. What you need is only one DLL that should
> be with the EXE together and it is the "swt-win32-3063.dll" !! So your
> Program consists only of an EXE-File and a single DLL?!?
> Nice day.
What I need - just EXE-file, without even this single DLL.
When user clicks on application via Intranet, I can not pass two
files, only one (EXE).
I know about GCJ can use it to create EXE, but it still requires SWT DLL.
>
> Konstantin Scheglov wrote:
>
>> melko <melko@gmx.at> wrote:
>
>
>> BTW, do you know, how to link SWT DLL directly in EXE ?
>> I need to have single EXE, without additional DLL's.
>> And I am afraid that this is impossible. :-(
>
>
>>> try this:
>
>
>>> make an build.bat with the following code and then it should make an
>>> exe out of your java files easily.
>
>
>>> @echo off
>
>
>>> SETLOCAL
>
>
>>> echo Name of the Main-Class...
>>> set MAIN=Main
>
>
>>> echo set the evironment-paths...
>>> PATH C:gccbin;C:gcci686-pc-mingw32bin;%PATH%
>>> set SWT_DIR=C:gccswt
>>>
>>>>>> in this SWT_DIR you have the *.dll of SWT and the swt.jar
>
>
>>> echo making dir...
>>> if exist bin rmdir /S /Q bin
>>> if exist obj rmdir /S /Q obj
>>> if exist include rmdir /S /Q include
>>> mkdir bin
>>> cd bin
>>> mkdir resources
>>> cd ..
>>> mkdir obj
>>> mkdir include
>
>
>>> echo Compiling to JAVA-Bytecode...
>>> gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin srccomtestgui*.java
>>> gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin srccomtestguidialog*.java
>>> gcj -C -fCLASSPATH=bin;src -g0 -Os -d bin srccomtestguifunctions*.java
>
>
>>>>>> here you set the path of your java files?! So it is your workspace!
>
>
>>> echo make an *.jar archive...
>>> xcopy /Q srcresources*.* .binresources >>>copy the ressources, if you
>>> have
>>> cd bin
>>> jar cf %MAIN%.jar .comtestgui*.class .comtestguidialog*.class
>>> comtestguifunctions*.class .resources*.*
>>> move %MAIN%.jar ..include
>>> cd ..
>
>
>>> echo make an object...
>>> gcj --classpath=obj;bin;%SWT_DIR%swt.jar -fjni -g0 -Os -c
>>> include%MAIN%.jar -o obj%MAIN%.o
>>>
>>>>>> here you set the swt.jar into the exe plus the now generated main.jar
>
>
>>> echo makes library...
>>> cd obj
>>> ar -crs lib%MAIN%.a *.o
>>> move lib%MAIN%.a ..include
>>> cd ..
>
>
>>> echo compiling the EXE-File...
>>> gcj -mwindows --main=com.test.gui.%MAIN% -fjni -g0 -Os -s -o
>>> %MAIN%.exe obj*.o include*.a -L%SWT_DIR% -lswt
>
>
>>> echo give a name to the EXE...
>>> if exist Test.exe del Test.exe
>>> ren %MAIN%.exe Test.exe
>
>
>>> echo.
>>> echo Finished!
>>> ENDLOCAL
>>> pause
>
>
>>> I hope I could help!
>
>
>>> nice greatings from austria.
>
>
>>> PS: You should delete in the source code the text that I have added with
>>>
>>>>>> starting!!! Thanks
>
>
>
>
>
>
Konstantin Scheglov,
Google, Inc.
|
|
|
Re: swt.lib ?? [message #446715 is a reply to message #446714] |
Wed, 01 December 2004 13:50 |
Eclipse User |
|
|
|
Originally posted by: melko.gmx.at
Konstantin Scheglov wrote:
> What I need - just EXE-file, without even this single DLL.
> When user clicks on application via Intranet, I can not pass two
> files, only one (EXE).
> I know about GCJ can use it to create EXE, but it still requires SWT DLL.
Yes thats right. You need this second file. I hope you can find the
solution for your problem.
I have an other prolem: I also work with gcj and I can make an EXE file
but my aplication needs a connection to a database so i search for the
database-driver dynamically like "Class.forName(klass).newInstance();" and
in eclipse it works fine but when I make the EXE file I cannot insolve the
driver jar so I cannot make a connection?!? Do you have an idea, if yes
could you post the source code. THANKS!!
|
|
|
Re: swt.lib ?? [message #446726 is a reply to message #446714] |
Wed, 01 December 2004 17:20 |
Eclipse User |
|
|
|
Originally posted by: skpeter._no_spam_.myrealbox.com
Konstantin Scheglov wrote:
>
> What I need - just EXE-file, without even this single DLL.
> When user clicks on application via Intranet, I can not pass two
> files, only one (EXE).
> I know about GCJ can use it to create EXE, but it still requires SWT DLL.
Konstantin,
Have you considered using Java Web Start to deploy your application over the
internet?
Peter
|
|
|
Re: swt.lib ?? [message #446741 is a reply to message #446726] |
Thu, 02 December 2004 06:00 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
Peter Skopek writes:
> Konstantin Scheglov wrote:
>
>>
>> What I need - just EXE-file, without even this single DLL.
>> When user clicks on application via Intranet, I can not pass two
>> files, only one (EXE).
>> I know about GCJ can use it to create EXE, but it still requires SWT
>> DLL.
>
>
> Konstantin,
>
> Have you considered using Java Web Start to deploy your application over
> the internet?
Yes, but my users don't have Java installed.
In reality this application has goal to install other applications on
user's computer. Not only Java, it will install/update any application
on our enterprise.
--
SY, Konstantin.
Konstantin Scheglov,
Google, Inc.
|
|
|
Re: swt.lib ?? [message #446742 is a reply to message #446715] |
Thu, 02 December 2004 06:02 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
melko writes:
> Konstantin Scheglov wrote:
>
>> What I need - just EXE-file, without even this single DLL.
>> When user clicks on application via Intranet, I can not pass two
>> files, only one (EXE).
>> I know about GCJ can use it to create EXE, but it still requires
>> SWT DLL.
>
>
> Yes thats right. You need this second file. I hope you can find the
> solution for your problem. I have an other prolem: I also work with gcj
:-(
> and I can make an EXE file but my aplication needs a connection to a
> database so i search for the database-driver dynamically like
> "Class.forName(klass).newInstance();" and in eclipse it works fine but
> when I make the EXE file I cannot insolve the driver jar so I cannot
> make a connection?!? Do you have an idea, if yes could you post the
> source code. THANKS!!
You can try to have direct import of this class, i.e.
import com.provider.DriverClass;
--
SY, Konstantin.
Konstantin Scheglov,
Google, Inc.
|
|
| | |
Goto Forum:
Current Time: Thu Sep 26 01:38:30 GMT 2024
Powered by FUDForum. Page generated in 0.06575 seconds
|