SWT Deployment as EXE - swt

I've recently started learning SWT (on class #4, to be precise) due to business requirements, and previously I had been developing with Swing for 2 years.
We deployed Swing applications as jars with resource dependencies. In SWT, what are the deployable forms and equivalents?
I have questions but since my training is online, I'm on a course-ware and there is no instructor, except StackOverflow:
Can SWT apps be deployed as independent EXE's? And what's with the "Eclipse EXE" thing people talk about? Does it mean that all SWT outputs will be Eclipse based EXEs? Or can they be completely independent EXEs?
If the answer to 1 is yes, how does the compiler produce native win32 executable code? This is one area where I'm thoroughly confused. Typically, a deployable jar is fed to the VM which reads the manifest and does its stuff, but an EXE as output? What's really behind the scenes?
How are external resource bundles managed? At the time of deployment?
Internationalization support?
Thanks.

Deploying an SWT application is exactly like deploying a Swing app, with the addition of several jars and a native library. You must currently be using some tool to make exe files for your Swing app; that tool may or may not be competent to also package up a native code library. It is unlikely that the tool is creating 'native win32 executable code'. Rather, it is packaging up Java class files along with the JRE and a stub Windows PE file.
SWT is developed as part of Eclipse. Eclipse has the Rich Client Platform, or RCP. If you build your Java application as an RCP application, you can use the Eclipse tools to generate an executable package for Windows (or anywhere else). It is not a single executable, it's a directory with an executable in it. However, you don't have to use Eclipse to use SWT.
An RCP application has to use much more than just SWT. It has to be constructed as a set of OSGi bundles that depend on the core Eclipse platform. Once you have such a thing running inside Eclipse, there is a wizard in Eclipse that will create a Windows 'executable' (a directory containing your code in JAR file(s), a lot of Eclipse code in JAR files, the JRE, and a PE .exe stub). You can automate that process from ant, though I've never done it myself. You will need to do book-length reading to get up to speed on all of this, I fear.
There no difference between SWT and Swing in terms of resources and internationalization. Other Eclipse-related libraries include an I18N discipline, but not the core SWT. You just use locales and property files as in any other Java application.

SWT is not Eclipse-based, but the Eclipse UI is SWT-based. Eclipse uses the SWT library for its drawing. It is used a GUI library from the Eclipse consortium, available for many systems. If you want to deploy your normal Java Application with an SWT GUI you just add the corresponding libs and .dll's or .so's. Therefore, everything you can do (deployment) with Java respectively speaking Swing, can be done with SWT, if you provide the according libraries. There are tools and ways to compile everything into .exe's but that is not necessarily needed.
I do not really get the Eclipse EXE thing you are talking about, but eclipse just provides a starter exe, which is basically just a wrapper. Otherwise, some people refer to Eclipse RCP als Eclipse EXE but this is not correct. You CAN use the Eclipse RCP to base your App and this would use SWT as UI library. But you can use SWT all by yourself just as library without the Eclipse trail.
I hope this helps.

You can use a java to EXE wrapper like this one http://jsmooth.sourceforge.net/.
Hope it helps.

Basically you need to get your project running with the conventional java -jar command.
Then create an exe bootstrap program that runs the command when you double click it.
Extra things can be done like checking JVM versions inside the exe program.

Related

Is there a simple way of adding griffon functionality to groovy?

I've been learning about groovy and it works nicely with eclipse via the eclipse groovy plugin. I've been informed that I should use griffon if I want to write desktop applications.
Is it possible to add libraries/jars/etc to my groovy install so that I can create griffon applications? (I know that I could try this instead, but it doesn't really do what I want.)
Griffon is more than just a set of libraries, it's a full blown framework that provides a command line tool that takes care of many things, like processing resources, launching the application, packaging and deployment. It's also extensible via plugins. This being said, you cannot build a Griffon application with just its runtime libraries placed under ~/.groovy/lib

Compiling and running an OSGI application in Eclipse

The base of our enterprise application is OSGI and we have several Java projects that are logically OSGI bundles. We use Maven to compile the application using the Maven Bundle plugin. But this process is time consuming and makes it impossible to debug the application. We also use the Runner and Pax(:provison) plugins to run the application. If we could rely on the Auto build function of Eclipse and also debug the application it would make our lives so much easier. Is there a way to configure Eclipse to be able to compile (and may be run) an OSGI-based application?
I'm not entirely sure if I understand you, but here goes.
Well, running/debugging OSGi applications in Eclipse is really easy, as long as your bundles reside in PDE aware projects or at least are on your target platform.
Do you have the source of all your bundles? Debugging without source isn't all that useful. If you do, can you just import all the source of your bundles into your Eclipse workspace?
Otherwise you can create a target platform, add all your bundles to that. (as a first attempt, I'd say dump all your bundles in a directory and point the target platform there)
Either way, then you should be able to Run (or debug)-> OSGi framework -> New -> Pick your bundles -> Start
You can both pick bundles from or target platform and from your workspace.
For building, you can use Eclipse Plugin Development Environment (PDE). Despite its name, it isn't specific to building Eclipse plugins and can be used for working on pure OSGi bundles. Eclipse plugins are OSGi bundles with some extras.
Cannot help you with the running or debugging part, although I do know that some enterprise-oriented OSGi platforms provide extensions to PDE.
If you're already using the maven bundle plugin, you may find that PDE's manifest-first approach isn't a good fit with your existing code-first build (I assume at the end you want both an IDE build for development and debugging, and a command-line build for continuous integration and automated testing).
You have two choices. As others have suggested, you can use Eclipse's integrated PDE, and use Tycho for your maven build. Tycho uses the same data used by PDE, so you don't have to write things down more than once. Alternatively, you can stick with the maven bundle plugin and use bndtools within Eclipse. Like the bundle plugin, bndtools is code-first, so you won't need to worry about maintaining manifests. However, you may find there isn't quite as big a set of features in bndtools as in PDE, and I'd suggest still checking your manifests by hand to make sure you understand what's being generated. Whether you prefer manifest-first or code-first is a bit of a heated philosophical debate.
Look at bndtools. bndtools is using the same bnd that is underlying the maven bundle plugin. You can even use bndtools together with m2e. bndtools is available from the Eclipse market place.

seam-gen vs eclipse seam web project

I'm trying to learn how to develop a j2ee web application but is currently figuring out what's the advantage of using seam-gen vs eclipse seam web project or vice versa.
Why would I use one over the other?
Thanks,
czetsuya
Command line seam-gen stuffs the whole application into a single project and included some files that we didn't need (6 versions of the messages file, for example, each in a differnet language).
The eclipse jboss tools seam-gen produces a bit more modular, streamlined app. It generates 3 separate projects (4 if you want a test project). It took some time to get used to it, but once I got it down, I prefer it. Additionally, when you create he project in eclipse you can leverage more easily the benefits of using those integrated tools.
You can do this with a seam-gen commandline-generated project as well by creating an eclipse project using your seam-gen project as source , but it takes some fiddling around in eclipse to get the settings just right.
My recommendation is to go with eclipse/jboss tools. If you come from a command-line centric background (as I did), the learnign curve may be a bit steeper, but in the end it will be worth it. Use the jboss tools forum for questions you have about this project.
Good luck. Once you get going with eclipse/jboss you'll find it's a great environment to work in.

Is there something like OLE available in Eclipse RCP?

We have three Eclipse RCP applications running in parallel. Now I need to implement another RCP that displays/operates part of the running applications. In Windows the solution would be to provide the functionality as OLE-Control.
How can I achieve the same thing in Eclipse?
There is some limited OLE interation (OLE Documents and ActiveX controls) in the OLE SWT package available in the win32 version of SWT. You would need to make sure that you ran different versions of this RCP app on win32 vs another platform or you encapsulated any per-platform code in a fragment.
See http://www.eclipse.org/articles/article.php?file=Article-ActivexSupportInSwt/index.html for an introduction to SWT OLE integration.
There isn't an OLE/inter process communication within Eclipse. You can stick to plain Java way of doing things (such as a TCP-IP connection between processes)

Compiling Jython for web apps in Eclipse

I have PyDev set up in Eclipse to do Jython web development. Instead of using the Jython interpreter to handle my servlets I prefer to use the Jython compiler instead for a particular project I'm working on.
Within Eclipse I use Tomcat to test my web apps. The sort of process that I'm looking for is would be very similar to standard Java web development. I'd like to do something like;
Put my Jython scripts in the source folder.
Have the Jython compiler compile the scripts into Java classes when I republish to the Tomcat server.
Pretty much the same as if I would use Java but with Jython scripts instead. I'm having trouble setting this process up in Eclipse. What would be the best way to go about this?
Maybe you have a look at snakefight