Scripting Eclipse - java

I'm wondering if it's possible to script certain actions of Eclipse itself. I'd like to be able to start a server, stop it, etc. Is this possible and if so, how?
Edit: I'd like to be able to do this so I can run certain server commands just through an SSH connection, no physical interaction required. Thanks.

Note that Martin OBERHUBER announced in his blog (April 2012):
I've started a new initiative to get scripting support back home to Eclipse.org and unify the fragmented landscape a bit.
a mailing list dedicated to scripting in Eclipse: eclipse-scripting-dev
an "Eclipse Scripting BoF session at EclipseCon 2012" page lists the first initiatives.
So:
10 years after bug 8519 (keystroke macros recording and playing capability),
9 years after bug 37680 (Add Eclipse automation),
6 years after bug 158716 ([Workbench] Pull Scripting support into platform),
..., that topic might finally evolve.

I think it is not supported OOTB. You can configure external tools which are basically just canned command lines that you can pass workbench variables. You can write scripts externally in Perl, Python or whatever and invoke them as external commands. The output can be captured in a console tab and you configure it to trigger a workspace rebuild and/or refresh.

You would probably want to check: http://www.viplugin.com/scripteclipse.htm
I am using it to run JavaScripts inside Eclipse to automate some tasks.

Eclipse has a headless mode, mainly tailored for headless builds, but you might be able to leverage that for your purposes. You'll probably have to create your own application or plugin to handle what you want, assuming that the features you need aren't GUI dependent. Search Google for "eclipse headless" to get started.

As of June 2014, the latest official scripting initiative seems to be:
EASE
The project is still under incubation.

Regarding the answer from vonC:
Eclipse scripting got really active again in the last view weeks. Currently the development takes place at github: https://github.com/adaussy/EScriptMonkey
We are striving for a dedicated project in the e4 incubator. A first prototype will be available by end of October. Interested parties may visit the "Scripting baby" session at EclipseCon Europe 2013.

Related

What are some alternatives to Selenium?

What are some web UI automation frameworks available out there?
I know about this question, but it was asked 3 years ago and things have changed a lot since then. I just wanted to find out if the answers to that question are still relevant or there have been newer and better tools developed since.
I'm asking this again because after doing some googling I've stumbled upon tools such as Geb and Capybara that were not mentioned as an answer in that question.
there have been newer and better tools developed since.
Take a look at the TestCafe testing framework. It runs functional tests in any modern browser and any device. No WebDriver required.
TestCafe is a pure node.js solution.
It can be easily installed (npm install -g testcafe is enough).
Works without plugins for browsers and additional configuration.
Write tests in ES6 and ES7 JS syntax.
Has smart waiting system, so runs async tests fast without extra waiting.
Can be easily integrated to your CI system.
Support for running tests on remote machines, devices, and cloud.
Free and open source.
You can use WATIR with Cucumber. Infact facebook uses watir for its UI automation.
I would definitely stick with Selenium, TestNG (and Selenium Grid for industrialisation).
If you want something at a slightly lower layer, you can also look at HtmlUnit.
IBM Rational Functional Tester (IE and older firefox builds) or QA Wizard.
RFT runs on Java/Eclipse.
https://stackoverflow.com/a/13024991/423955
Sahi (http://sahi.co.in/) should be the best alternative for selenium. One can use java or javascript for the sahi scripts, php and ruby driver is also available (no personal experience with Ruby or php). Very effective with cross browser as well as cross-platform.
Some of the lovable features are: No explicit wait required. For element identification _near, _under, _in etc ApI's are very useful. Logging/Report, feature is inbuilt with Sahi. No Complex configuration required to run the Sahi scripts

JSP tools for a Ruby/Rails developer?

I am a full time rubyist, really enjoying rails, Sinatra, etc. Currently, however, I find myself working on a Java/TomCat/JSP project.
I was hoping someone could help me find tools, articles, books, and any other resources that will make me more comfortable?
I'm aware that Java is very different from Ruby, and the communities, likewise, are very different. That being said, all of the documentation around Java (that I have found) is a mess, and discovery is very difficult in this community.
Things I'm specifically looking for:
development environment setup tips
logger, logging, colorful output, best practice, etc
library resources and documentation
easy to navigate documentation for Java SE 6
anything you have found that makes your daily life better
Thanks!
If you are joining an existing Java project then you probably want to take a look at the tools already in use and get an existing developer / co-worker to bring you up to speed with them as a first port of call.
Having said that, here are my top tips:
Get comfortable with one of the main Java IDEs. Eclipse (my personal choice), Netbeans or IntelliJ are all excellent and very powerful tools once you get to know them. The refactoring / code navigation tools are probably better than anything you are used to in the Ruby world, they will help you a lot. Java is a lot less painful with a good IDE setup.
Learn Maven - this will take some time investment but it is extremely powerful for automating your dependency management and build process. Once you get it working you will save a huge amount of time on project / build management. Maven also provides automated access to the equivalent of Ruby gems through the various public Maven repositories.
And here are some particularly useful resources:
Java tutorials - good to get an introductory feel for the core Java libraries.
Java 6 API - useful as a reference resource for all the classes and functionality available in core Java (a lot of this is also provided via the IDEs)
JSP Documentation - for the JSP / Java EE aspects
As a little side note don't forget to learn about JSTL and Expression Language.
first of all you are on the right road to discover how elegant Java EE is. since you adressed various topics i will divide my answer into different parts :
Development environment:
Without further talk i will advise you to directly go and pick your eclipse Java EE Juno (last release) version, however if you'd like to have a look at other IDEs you can either check NetBeans 7.2 (last release) or IntelliJIDEA 11.2 Ultimate (last release i know of and that I have). Basically Eclipse has tons of plugins and features and backed up by a very great, large and passionate community.
[ i personally tried NetBeans, and IntellijIDEA, but felt more comfortable with Eclipse because of its look, features, cool color theme etc]
For JSP and HTML, CSS ,JS stuff, i however recommend the great IDE of Jetbrains Webstorm it has zen coding as well as many many other things like fast auto completion and support for many frameworks.
Lastly, pick up Sublime Text 2 as a text editor for quick edits or to just check a source file, it has a very beautiful layout and support for many languages as well as tons of plugins.
Ressources and documentations :
All the Java API specifications are available for offline viewing for free in Oracle's website and come packaged with the various SDK that are available there.
The easy to navigate documentation :
Eclipse IDE makes it very easy to attach JavaDoc and Source to the different jar files that make up a JDK, that said, your learning and coding experience will be greatly increased once you've set that up.So when you type Connection for example in IDE, you can simple hold Ctrl command then right click on it and the source code of the class implementation would be opened in a different tab. yes yes it's the power of the open source world :)
Concerning tips and tricks :
I'll recommend you use //TODO comments as Eclipse has support for them and you can setup your own TODO comments in settings, also you can use TASK comments, you've Mylyn too to manage your bugs, tasks either locally or connect to your favorite bug and issue tracker through a connector since many connectors are available for such purpose. Add to this list the possibility to configure bookmarks to help you manage your source files when they become full of lines.
About Tomcat:
Well if your goal is to make Java EE applications that do not require the advanced features of the Java EE specification, then you can use the sweet Tomcat, it's easy to use and configure and a well known web container.
However if that's not the case, and you wanna specialize in Java and spend lots of time to try to understand the ins and outs of this huge specification, you are likely to need a certified Application Server that supports all Java EE components. There are lot of them available, but since you asked for advise and I am here giving my modest suggestions I would advise you to pick the GlassFish Application Server, it's Open Source, and once you install it on Eclipse IDE for example, it will be bundled with both Java EE 5 and Java EE 6 API doc. This means no time to be wasted on browsing different tools and tabs, you will have everything grouped inside your Eclipse IDE so that you are 100% on the tasks at hand.
p.s: if you've any more questions please feel free to ping me.
Any good tip or trick :
Have fun with Java, because you will be learning everyday something new :)
p.s: i didn't mention any framework, because by the time you get used to Java EE you will be in position to pick the one that suits your needs. Also forgot to mention JUnit (Testing Framework) and a great eclipse plugin EClemma for code coverage (much better than Cobertura/eCobertura and easier to use), and of course you can try Maven as the other post mentioned, or try Apache Ant as build tool.
If you're coming from a Rails background, I'd be prepared for some initial frustration. Setting up projects in an IDE can be time consuming, and generally it's going to be more painful to get things like a basic web+app server up and running using Tomcat than using Ruby.
For a REPL, I would recommend Groovy (and indeed it comes pre-installed on Intellij) but you can also use BeanShell. Grails, or groovy on rails, is probably the closest thing we have to a Rails-like environment.
As others have said, with Java, using an IDE is really best. I like Intellij IDEA, but eclipse and NetBeans are also good.
For build and dependency management, Maven is probably as close as we have to standard, although I have heard nice things about Gradle.
There are entirely too many logging frameworks in java, use whatever your project currently uses, probably log4j or SLF4J. learn how to change log levels across the board, and also at a package level.
In terms of libraries, Google's Guava makes my life better on a daily basis.
The best "tips, tricks and general best practices" book on java is Josh Bloch's Effective Java. For documentation, the Javadoc is the authoritative source. Learn to read and write good javadocs.
For Test Driven Development, jUnit is probably the most widely used library, a very popular library is mockito, which also happens to be my favorite.

TFS for Java - bad idea?

We're considering TFS for our .NET based projects and as a task management platform.
Some teams develop exclusively in Java and they're quite happy with SVN (Subclipse).
Our managers came up with the following questions:
Should we migrate the Java teams to TFS as well?
Does TFS (source control only) handles well Java projects?
Is it a pain to migrate our Java code base and history from Subclipse to TFS?
Currently we are looking to use TFS as a sole source control platform for maintainability reasons. We would like to avoid having our IT guys supporting multiple systems.
Thanks
Full disclosure, I work on the team that write the Java tooling for TFS so take this answer as appropriately biased :-)
As far as TFS is concerned - all code is created equal. It's just bytes in files that it checks in to version control. Like all SCM systems it doesn't care what language the files are written in.
Microsoft provide a full, rich TFS Plug-in for Eclipse (called Team Explorer Everywhere). This provides full source control, work item tracking, build, sharepoint, reports access etc into TFS from Eclipse based IDE's. It's written in 100% Java and talks directly to the web services exposed by TFS.
In addition we also provide a cross-platform command line client for TFS so that you can talk to TFS from the command line on your operating system of choice (Mac, Linux, Solaris, HP-UX, Aix etc all fully supported).
Finally, if you have tools written in Java that want to talk to TFS then they can make use of the TFS SDK for Java which is the full API that we used to create the Eclipse integration and cross-platform command line client but packaged up with samples and snippets and ready for you to redistribute with your applications.
When it comes to build you have a couple of choices. If you want to stick with your current build server then it is likely that this already supports talking to TFS (all the popular open source build servers do). In addition to that, Microsoft provide the TFS Build Extensions which allow you to run Ant or Maven based builds on the Team Foundation Build server. The build results (along with any warnings or errors) are published back into TFS along with any JUnit test data if you execute JUnit tests as part of your build. Also you get to create and manage the build definitions in the Eclipse IDE and have one place to manage access to them etc.
So - the level of support for Java is very high and Microsoft has shown consistent investment in this area. We recently shipped some TFS 2010 Power Tools for Eclipse and we've also been shipping preview releases of Team Explorer Everywhere 11 alongside Team Foundation Server 11 (we're the same team inside the company).
To import history from SVN, that's the same as importing history from any SCM tool into TFS (or TFS into any SCM tool). You have a couple of options. You can take a snapshot and cut over at a particular point (such as a release) or you can migrate history. To Migrate history from SVN there are some partner solutions available including one from Timely Migration that I've seen a lot of customers have success with.
Hope that helps.
After a year of working on a Java/JVM project using TFS, I would like to dissuade anyone from doing this. While TFS may be considered top-of-the-line for .NET developers, you won't find any Java Developers with any experience with it. There is the plug-in for Eclipse and a port to IntelliJ, but I've had terrible luck with both, though I'm guessing it's mainly because TFS does not work like any other VCS I've used.
On our team, we've estimated a 10-15% overhead due to TFS and complications caused by it. Days of work lost because TFS decided to overwrite files, days of troubleshooting issues caused by incomplete TFS Updates. We have done a branch in 6 months because the entire team lost two days the last time we did. It's common to hear the phrase "I just updated with your latest changes, can you come check to make sure nothing disappeared in the merge?". Instead of using Jira, we're stuck using the terrible issue-tracking in TFS, causing more yet more issues.
Several of the developers on the team have taken to either using git, either standalone or the git-tfs bridge. Others just copy the source tree prior to any 'risky' activities, like updating or checking in.
Either way, I wouldn't recommend it for a team that does not have experience with it...
I like the answer of #Martin_Woodward a lot, but it is too much biased in my opinion, so I add my 2 cents here. We in our company are in a similar situation, and the decision (in my opinion) depends on the context. I can see 3 different situations, and the decisions may be different in each one:
You are mostly developing .NET solutions, and the Java parts are integrated in the .NET solutions.
Your .NET solutions are independent developed from the Java solutions, and they are half .NET, half Java.
Most of your solutions are developed with Java, and only a small percentage is developed with .NET
I would agree with Martin only in the first case. You will gain profit from the common development environment, source code control, build process ... Your Java guys will learn the differences to TFS Source Control (does it have a name??). And your future will look bright ;-)
If your .NET solutions and Java solutions are independent from each other, the only argument to use TFS for developing Java solutions is cost in operation. And you should carefully look at it, if the savings for operating the development environment only TFS will out weight the additional cost of switching your Subversion projects to TFS.
In the last case, it would be an awful decision to switch with a lot of people just to have a common environment to develop. You may integrate Subversion into VisualStudio (using e.g. VisualSVN or other plugins), and you have nearly no invest at all.
The migration of source code including history is normally a pain, and it depends on the source and target if that works well. We have good experiences with CSV and SVN, but no (good) experience with others. But that is normally not a problem, you may use your old SVN repositories (read-only) and just migrate the last milestone. After some time, SVN repos may be let alone ...
After 1 year working with TFS/Java I completely agree with Dusty J (Yes, TFS/Java is bad) and completely disagree with Martin Woodward about great Microsoft support. Although for my duty as a developer the Eclipse TFS is OK, the problems are for my build/release duties.
First, this Eclipse plugin does not allow creating a branch for several projects at once as in CVS/SVN. One needs to create a branch separately for every project. Then we cannot keep the same project names in the branch – one needs changing a project name and after checking out from the branch to rename to the original name. See also my post How to associate an Eclipse Workspace with TFS workspace?, there is no way to associate an Eclipse workspace with TFS workspace. Thus, the mapping for a local folder cannot be saved; it needs to be done again after opening another Eclipse workspace for branch building. And since the local mapping is the same there is a possibility of erasing a local folder with unsaved work as Dusty J wrote.
This removing local files without warning is a terrible feature of TFS (see the post Why command get from a command line in TFS removes parallel projects?). What Microsoft thinks about the possibility of erasing local files just under regular option "Remove Local Mapping" in Eclipse?
So, despite my effort to learn TFS I still spend 10 times more time for various builds as compared to CVS I used before.
(Another biased MS employee)
TFS formed a team about 18 months ago to focus solely on making the Java experience great in TFS/Team Services and across all platforms. I am on that team and I think we have made a ton of great progress. I won't disagree that the end to end story was pretty bad when this question was asked, but I think the answer has changed quite a bit in the last year.
My team provides build and deployment tasks for TFS as well the plugins for Eclipse and IntelliJ to make the end to end experience as complete as possible. We are also working hard to make sure we document how to get the best out of TFS if you are a Java developer.
If you want more details, checkout http://java.visualstudio.com.
Thanks,
Jason Prickett
Why not use SVN for the .NET projects? Is there any reason for that? There are multiple plugins for SVN in Visual Studio as well as a windows shell extension.

UI for a Desktop App

I have a desktop application . The functionality is complete, but user interface requires a lot of work. I am looking for UI tools.My current operating system is Windows and application is required to run on both Windows and Linux.
Can you guys recommend any?
The software is customized file management application for a specific client, with future plans of web integration.
Thanks in advance :)
Application Environment
Lang : java,
IDE : Eclipse 3.4,
Target Platforms : Windows Vista-OpenSuse 11
SWT is another option. The advantages are a look-and-feel closer to the native platform, and generally faster execution times. The main disadvantage is that you will have to have different distributions for different target platforms, as SWT depends on platform specific libraries.
With an eye toward the web integration, look at GWT. You write your interface in Java but it gets generated into Javascript and can thus be run in a browser. This may make your deployments easier. On the downside, you lose a bit of the rich client UI, but maybe you don't even need that. It all depends on how complex your UI is.
A word of advice: you mentioned future plans of web integration. Take special care to isolate what logic you can from the UI. Keep the UI as clean as possible, and then you may be able to use the same logic in the web UI either on the client or the server.
If you are just looking for a GUI designer you could check out Netbeans IDE which has a built-in Swing user-interface builder.
Alternatively you could build a front-end in JavaFX. There's not much tooling for FX yet but a new tool was recently previewed at JavaOne 09. Not sure when it's being released.
I've used Qt a few times and find it very good at this sort of thing -
Qt Home Page I'm not sure if it's exactly what you're looking for as your application is complete, however, but it may be worth a look.
Found an excellent fix,
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(myform);
looks so cool in my vista and suse , its enough for now.
Thanks for everybody for helping out

How to start using and developing on Ubuntu Linux? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am a newbie Linux user who came from 10 years using windows OS, and developing in Microsoft languages.
I want to have a good experience in Linux world and developing on it.
First, I want to learn how to use this new OS, then how to start developing on it, I am interested in web applications, specially using Java/PHP because I have some experience in both and it will be a good start.
Second, I want to learn how to develop on it.
Are there any video tutorials to give me a good starting push? any recommended books or references?
Suggestions
Environment Setup
I would recommend you install a the JDK if you are doing Java development. Look here for instructions on using apt to install the sun JRE.
Then, get yourself a decent IDE setup. Try Netbeans or Eclipse - both can be configured to work with php as well.
Also make sure you install php and Apache, here are some instructions.
Since it sounds like you are going for the classic LAMP setup, you may as well install PostgreSQL or MySQL.
That should get you running far enough to make videos, etc useful.
Development Resources
IDE Resources
Guided Video Tour of Netbeans 6.5
Eclipse and Java Video Tutorials
Java
Java Antipatterns - Learn what not to do in Java.
Apache Commons - Get libraries for common tasks in Java.
PHP
PEAR - Get libraries for common tasks in PHP.
ADODB - Get a decent db backend for PHP and learn how to prevent SQL injection attacks from the start.
Start to play around with a web dev framework.
Ubuntu Pocket Guide
If you're new to Linux, I'd suggest you look at the Ubuntu Pocket Guide. It goes through basic stuff that any user would want to know - window management, system configuration, etc, as well as some historical background on Linux and Ubuntu. You can skim through that and learn a bit.
Bash Basics
Towards the end, it also explains the basics of bash, which is the Linux command line. That part is interesting - you can do a lot more in bash than you can do in the Windows command line. For example, you may be familiar with this Windows idiom:
dir > directorylist.txt
...which means, "list the contents of this folder, and instead of showing the output, put it in this file."
In Linux, you can do that, and you can also do piping, where you direct the output of one command into another. For example:
ls | grep foo
means "list the contents of this folder, and search through the output for the regular expression foo." You can add as many pipes as you want and use a variety of commands.
You can also use brace expansion to run multiple commands in sequence. For example,
mkdir photos_{france,spain,italy}
will create directories called photos_france, photos_spain, and photos_italy.
If you're going to be developing in Linux, you should invest the time to read some tutorials on bash to take full advantage of it.
Since both Java and PHP are cross platform, it seems your biggest task would be to familiarize yourself with GNU/Linux and tools related to web development, apache web server in particular. Here are a few things google gave me:
http://www.micahcarrick.com/09-28-2007/web-development-linux.html
http://httpd.apache.org/docs/2.2/
Have fun.
Another option is Lazarus, which is based on Free Pascal, which itself is based on Delphi.
Lazarus allows you to develop using Object Oriented Pascal, across Linux, Windows and MacOSX and produces natively compiled executables on each target platform.
Natively compiled executables are generally much faster than interpreter based apps (i.e. Java, C#, PHP).
Lazarus use a component and event based approach to development which allows you to design GUI by dragging and dropping components on a Form Designer, which then are hooked through events.
Good luck with your programming adventures!
Ubuntu Kung Fu might be a good start.
Java development is something you can do with ease using Eclipse on Linux. PHP development is more or less the same as on Windows. Use a good text editor to write the PHP scripts.
Installing the required tools might differ from how it's done on Windows, but both PHP and Eclipse are available as packages in Ubuntu.
If I was to recommend one thing, it would be that you must learn to love the shell. It takes time to feel at home in, but it's well worth it.
On a related theme - You might want to consider using emacs or vim as your editor, but that's more of a personal preference thing. Some people just like IDE's better.
You should probably focus on PHP, rather than Java. It's easier to get started with and it's much more true to the Linux tradition (Whatever that means) than Java is.
Eclipse should run fine in Ubuntu.
Try some Java development in it to get yourself started.
If you want to get your lamp setup pretty easily, you can take a look at Zend Server Community Edition. http://www.zend.com/products/server/downloads-all
For development eclipse (as suggested above) with PDT (Php development tools) is pretty good http://www.eclipse.org/pdt/. I prefer Netbeans though. You could also use gedit with some plugins see this

Categories

Resources