I've recently been converted to TextMate as a diverse and powerful programmer's tool. But it appears to be lacking in Java support. So, I've been trying to mess around with the supplied Java bundle (Compile & Run) but it only contains one line:
javamate_bootstrap.sh
I can't find this file on my machine, but it appears to only work for simple Java classes (ie, classes not contained within a package).
First of all, why is TextMate so useless for Java programming, and secondly (and most importantly) : Does anyone know of a bundle I can use, or have instructions on how to create one for larger scale Java development in TextMate?
Thanks in advance.
First of all, why is TextMate so useless for Java programming
Mostly because there are three free (free as in beer) java IDE's, IntelliJ IDEA, NetBeans and Eclipse that almost all professional java developers use. Any one of them will give you all the functionality you want out of TextMate and much, much more. Given that, there's not much demand for java features in TextMate or BBEdit, or Notepad++, etc. That's not to say people don't use them. They definitely do, but not in a high enough volume to make it worth it to the maintainers to add features to make java development easier.
Related
I am a hobbyist java programmer using NetBeans IDE. A problem I face with programming in Java is choosing the correct target JRE version. I understand that most of my friends have at least java 6, but few have a totally up-to-date version with which I compile. I know how to compile for a particular target run-time environment on NetBeans; the problem is that by using an earlier target release of Java, the compiler expects code written in that version.
For a specific example, I occasionally use a Java 8 lambda instead of a new Runnable(){}, however the compiler (or at least NetBeans) doesn't accept this 'modern' code. Another example is the use of the diamond operator, or the use of multiple-exception catch statement, neither of which are supported by Java 6. The language evolves and the compiler evolves, but older versions of Java cannot handle the change. To distribute my code, I am forced to use what some might consider outdated code.
My question is: Is it considered good practice or common practice to write Java for an outdated target version to provide compatibility? Is there some form of 'translator' or cross-compiler for Java code?
My question is: Is it considered good practice or common practice to write Java for an outdated target version to provide compatibility?
It is common practice.
Whether it is "good practice" or not, is highly context dependent. There is a pragmatic trade-off between supporting older applications whose developers don't want (or can't) upgrade, and holding back the development of your application by not making use of new (and presumably beneficial) features.
There is no universal "best" answer.
Is there some form of 'translator' or cross-compiler for Java code?
Effectively, no. For old versions of Java there were "retro-weavers" which allowed you to run "newer" Java on "older" platforms. However, this approach seems to have died out by Java 6.
To answer your first question, it really depends on the standards set by the company/office that you are working for.
From my experience, most of time big companies tries to stay with matured and well established development platforms, they might not give the cutting edge features of the new language, but the companies want the base platforms to be stable and secure first. And if the codebase is large and the project has been in development for a long time, they normally don't bother jumping into the new platform, since that means they might have to invest more resources to rewriting/refactoring a lot of code, which is not always economically lucrative.
I love using those features that you mentioned in my personal projects, but in my office works we are still using JDK6.
As for the second question, I think there are no workable things at this moment that can do the "translation" that you mentioned.
From my experience this isn't a big problem in the industry. Java is used mostly on the server, not so much on the desktop. And to setup a server with the required Java version is not a big deal. For desktop applications I also seen the approach to ship the JRE with the application. It is a little bit ugly to ship a small application (let's say 5 MB) with a 60 MB JRE, but in the "enterprise environment" it doesn't matter and is a practical way to provide the correct JRE. However, I don't like this approach since it leaves open questions, like how to ship security updates to the JRE.
And by the way: Is Java 6 still supported? To use an old JRE is pretty big security issue.
I am going to create a java project that uses JNI. I want to deploy the project as a stand-alone application, but some modules might be used as libraries of other applications as well.
I want to support different platforms and everything should be as painless as possible.
As far as I can see, I have the choice between the maven-nar-plugin, which wasn't updated for one and a half year now, and the native-maven-plugin, which seems less user friendly to me.
Do you have any experiences with one of them or recommendations which I should use?
I've only used the maven-nar-plugin for standalone C/C++ apps, but it's worked very well for that.
As for JNI, I've been using the native-maven-plugin for a few years now on a sizable application. We use it to allow our Java apps to interface with other applications that only offer C APIs. I've actually found it pretty user-friendly. The documentation is pretty good and explains basic usage, but you still have to deal with the C compiler and linker and whatever options that are required for building.
We just pass it the compiler and linker commands and options, the source location, and the javah file locations and it works. I have to say that with all of the pain we've been through with JNI, the maven plugin is one of the few things that hasn't been a big hassle.
The third slide in this presentation about the NAR Plugin by Mark Donszelmann of the Stanford Linear Accelerator Center compares the native-maven-plugin and the maven-nar-plugin. Quoting from slide 3, the pros and cons of the native-maven-plugin:
Pros
Very configurable
Cons
Did not run out of the box (no defaults)
No binary dependencies
Not cross platform (different profiles for different platforms)
I've used a lot native-maven-plugin since one year to cross-compile C and C++ source code (with a profile for each platform options like compiler, compiler options, linker options, etc...).
It works like a charm but I feel pretty alone in my situation.
Now, I don't understand why C/C++ developper still use make or cmake tools from an other era.
Maven is so better for managing versions and dependencies...
I want to use emacs for java coding, but I'm confused on what mode to use for java coding. There's jdee, which seems ide-like; malabar, who is said to be more well versed in java 1.5 constructs than jdee; and emacs-eclim, which is an eclipse backend for emacs. There are also a wealth of completion extensions for emacs, and I'm also confused on which one to use. In fact, I'm so confused that I deferred using any of them until I get recommendations.
What is the current best option for java-mode + completion in emacs? And, if ever I decide to use a combination of what I mentioned above, will conflicts happen?
For those used to the power of Emacs text manipulation then Eclipse can seem like pedaling a bicycle with one foot. The Emacs+ plugin from http://www.mulgasoft.com/ is excellent for getting Emacs key bindings into Eclipse.
I use both Eclipse and Emacs a lot, but if I only did Java development I might use only Eclipse with Emacs+. It takes some work to get many Eclipse features enabled on Emacs.
My advice is to use Emacs >= 23. If you are on a Mac, look at AquaMacs. I use JDEE as the Java plugin. This has the serious drawback of not playing well with generics. It's not that it stops working, it's just that a lot of stuff isn't recognized. Do not use the old 2.3.5 JDEE plugin (that comes with most Linux distributions), but get the 2.4 version from the sourceforge site. Also get the Emacs Code Browser (ECB); this is a plugin that will give you stuff like Eclipse's Project Explorer and Outline views (other developers will look at this and not believe you when tell them that it's Emacs). I've used this setup for commercial projects on Windows, Mac, and Linux in the past year.
In fact, Eclipse plays pretty well with Emacs and I often switch between the two. Eclipse has some nice refactoring tools that I used to use sed for, and it has a good debugger interface. You can use them simultaneously. I find that I use Eclipse when working with other people's code and Emacs when I am writing my own code---Emacs is that much faster. Note that for me, a lot of the value of Emacs is the non-Java functionality, like editing Tomcat configuration files on remote servers from my local Emacs, writing professional documents with LaTeX, developing in Python or Bash or MATLAB or XML, and the odd text manipulation task (e.g., converting CVS files into String[] arrays).
I haven't used the other two projects you mention. It is possible to use the Eclipse compiler with Emacs already, so I'm not sure I see the point of the emacs-eclim project, which seems to be moribund anyway. The Malabar project might be interesting, but seems to be the product of one somewhat cranky developer (e.g., the warning "if you're not using Maven (why?) you should not consider malabar-mode"---I'll tell my clients that?).
Java on Emacs is in a sad state. I wish for JDEE to be revitalized, but it's not clear when or if that will happen. The web site and mailing list offer few clues.
I use emacs-eclim with auto-complete-mode support and java-mode highlighting exclusively for Java programming. 90% of my work is done in emacs, but I switch to eclipse when I need to debug, run unit tests or do major refactorings. All in all, this setup works very well for me.
I haven't tried JDEE for years, but I remember it was a b*tch to set up. I didn't care for the UI very much, as it put up lots of prearranged windows that were locked in place. I like to be able to switch back and forth between editing buffers, often showing just one window, but splitting and rearranging on the fly when it becomes necessary.
Note: I am an emacs-eclim maintainer, and this has probably coloured my judgement.
If you're using Maven, then I'd recommend malabar-mode. It will set everything up for you automagically, no need for editing project files like you'd have to do with JDEE. The downside I've found with malabar, is that it can consume a lot of memory if you've got a lot of multi level module projects open.
Both Malabar and JDEE will give you "true" completion, i.e. only completions that are possible. However, there are two amazing "intelligent guessing completion frameworks" in Emacs. hippie-expand and auto-complete.
The former is great (can complete whole code blocks for you, making it possible to e.g. cycle through all if-tests in your projects), but auto-complete mode is even better. It'll give you a nice intelli sense style menu, will "learn" as you use it, and allows you to define a file with the completions you'd like to be available in the various languages.
I was looking for a Desktop Application Programming Language with one of the biggest constraint: - “I need to output as native executable”.
I explored multiple options:
Java is not a very good option for desktop programming, but still you can use it. But Java to Exe is a problem. Only GCJ and Excelsior-Jet provides this.
.Net platform does not support native compilation. Only very few expensive tools are available which can do the job.
Python is not an option for native compilation. Right?
VB6 is the option I am left with.
From the above list, if I am correct, VB6 is the only and probably the best option I have.
But VB6 itself has issues like:
It is no more under development since
There are questions on support of VB6 IDE with Vista
Thus my questions are:
From the list of programming language options, do you want to add any more?
If VB6 is good/best option, looking at its development status, would you suggest using VB6 in this era?
Delphi (and its underlying Pascal language) is still alive and well, with the 2010 edition recently released; if you have funding (a minimum of $899 for the cheapest edition, I believe). it may be worth your time to download a try a free-for-30-days (or something like that) version.
Out of curiosity, what are the driving factors behind the "native-binary-only" constraint?
As others have said, it's essentially impossible to prevent reverse engineering. (I realize the answer I linked to is in the context of .Net, but it applies to all programs.)
You added a comment saying it is because .NET and java can be decompiled that you don't want to use them. You could use an obfuscator which makes the output code harder to read.
Visual C++ is an option, though unfortunately the free version is a bit crippled from the point of view of building MFC-based applications.
You can also choose to use a different GUI framework than MFC, such as wxWidgets or Qt. With these frameworks a GCC compiler (such as MinGW) can be used. There are several free IDEs that are supposed to work with one or both of those frames works including Qt Creator or Code::Blocks.
I've heard good things about Delphi, but don't know anything else about it.
I was involved in a hunt for a similar language/platform for a client to replace their VB6 application. Although they eventually decided to webify everything and rewrite it all in Flex, they were briefly looking at RealBasic. VB6-esque syntax and it compiles to native binaries.
I can't speak for what it's like for day to day use; the trial looked ok. A bit of the RAD oh-that-didn't-take-long workflow that VB6 had and very little else has got anywhere near. Not unreasonably expensive for the Personal Edition.
Check out 'Power Basic' - It compiles 'true' small native EXEs and provides a fast VB like basic environment, and doesn't require a run-time environment. This makes it much harder to disassemble. It isn't VB, but its affordable and powerful.
VB is an interpreted language not native although I guess there are native compilers. Also it's runtime support is not guaranteed past windows 7. The IDE and runtime have a few issues in windows vista and 7 mainly related to UAC and network drives.
I would suggest delphi or some c variant if it must be native.
Hey all, my Computational Science course this semester is entirely in Java. I was wondering if there was a good/preferred set of tools to use in ubuntu. Currently I use gedit with a terminal running in the bottom, but I'd like an API browser.
I've considered Eclipse, but it seems to bloated and unfriendly for quick programs.
Java editing tends to go one of two ways; people either stick with a simple editor and use a terminal to compile/run their programs, or they use a big IDE with a zillion features.
I usually go the simple route and just use a plain text editor and terminal, but there's still a lot to be said for IDEs. This is especially true when learning the language, since hitting "spam." brings up a dropdown with all of the fields and methods of the spam object. And this is not just useful to a beginner; it remains useful later on when using unfamiliar libraries and third party modules.
IDEs also have useful tools such as GUI builders which become invaluable when doing professional Java work. So although I typically prefer a simple editor/terminal combo, I highly recommend trying out an IDE such as Eclipse or Netbeans to see how you like it and so that you'll know how to use one later on.
Eclipse may be bloated for learning needs, but will probably give you the best overall Java experience. Try working through some of the built-in tutorials if you find the interface confusing.
I too vouch for eclipse (or IDEA if you have the money, actually IDEA is better than eclipse by a small margin).
But, make sure that you know how to compile and debug without an IDE first, and also learn to read the compiler's warning/error messages - they are essential skills for developers that using an IDE can prevent you from learning.
Eclipse and NetBeans are both good options. If you don't mind paying a little, so is IntelliJ IDEA (an academic license costs $99).
As far as IDEs go, I've found Eclipse to be about the best you could ask for. If you are used to IDEs full of features like VS, it should be right up your alley, and it isn't particularly resource-hungry; the way it organizes your projects makes the whole thing pretty simple as well, and it's also good to have on your resume. If you're looking for a non-intrusive IDE, mostly intuitive and that does its job as a great assistant, go with Eclipse. Not to mention its customization options.
If, on the other side, you'd like a much more light IDE, textPad-style (why?), I'd recommend Geany; I've worked with it in the past and it's got all the basic features to get started with the language and not be overwhelmed with all the features that big IDEs can offer. But I'd still recommend to go with Eclipse as soon as you get used to the language and need the IDE to be more of an assistant.
Another vote for Eclipse. In particular, you should be able to install it from within Ubuntu, as there are packages for it in one of the repositories (I forget which one specifically, as I'm not at my Ubuntu machine right this minute). If you use the GUI package-management application under the "Admin" menu, you should be able to find Eclipse and related packages.
I'd actually just recommend Eclipse. It seems bloated at first, but once you get used to it, you can use it to develop code very very quickly (and thus it's an excellent choice for a quick bit of Java).
Features I like:
Control+1 for error fixing - it knows how to fix most compile errors - just highlight the error in the code (which will be underlined in red) and it will give you a list of suggestions. Control+1 selects the first suggestion, which is almost always correct.
You can use this error fixing feature to write code that uses methods you haven't written yet - the error fixing will create the method on the class/interface you called it on, with the correct parameters/name/visibility etc. Or, if theres a similarly named method with similar parameters, it will suggest you've spelt it wrong when you called it.
The refactoring tools are also supergreat - you can highlight a block of code to extract as a method, and it'll work out what variables need to be passed in, and what it should return (if anything). You can move variables between field and methods. You can change class/interface/variable names, and it will correct them only where it needs to (which beats a search and replace any day).
You really don't need to know many eclipse features to get the benefit of using it - and it'll dramatically speed up your coding. I wish I'd known how to use it at University.
Basically, I'd recommend Eclipse. The time saved coding will make up for having to click "yes" a couple times when you start a project..
I'm using NetBeans with success right now.
I usually just use vim, but i've actually found the IDE Geany quite intuitive with a lot of good features but not really overblown. Check it out.
EDIT: I don't think Geany is fit for enterprise-level programming, but for a quick program it's one of the better IDEs I've seen, especially if you've had bad experiences with NetBeans or Eclipse as I have.
As many others, I suggest you to use Eclipse. It works fine in linux and after a few days you will find it not so unfriendly.
Moreover, if you will start developing more complex programs in java, you already will be familiar with a standard, complete and open source IDE, which is also the foundation for many other professional IDE for other languages, like Adobe Flex Builder, Aptana Red Rails and so on.
There is an interactive "IDE" designed especially for learning: BlueJ at http://www.bluej.org/
While I generally agree that Eclipse, NetBeans, or one of the other IDEs can be very helpful, they are pretty heavyweight for a learning environment; and you can end up spending your time wrestling with the IDE instead of learning Java.
In my career I've also found some people that don't really understand what the IDE is doing for them; they are totally lost without it (see Voodoo Programming). I recommend you spend at least some of your time with a simple editor, like gedit or vim, and the command line javac compiler.
BlueJ is considered a good editor for Java, tough mostly aimed at beginners. It does not bloated as Eclipse, but contains many useful features. It is also an open source project, so you are welcome to give it a try.
In our working enviroment we have to use the free Oracle JDeveloper ... sigh .. at home I tend to use Eclipse more and I really like it
Netbeans is a heavy but good IDE. Netbeans always have many features you don't really need, but because it's made with the netbeans platform, you can always strip it down to the essentials !
If you don't like all the work, go with eclipse. It's a lighter IDE.
Geany is pretty handy, don't quite know how it is with programming Java, but with programming C and C++ it's a nice light weight IDE. (BE WARNED: Building big projects usally tend to fail in geany. Workaround: compile in Geany build in terminal)
Bryan