Java programming on Linux
[workflow] Best setup for developing in Java on linux?
I use Ubuntu/Mint with Oracle's JDK. IntelliJ for the IDE. There is both a free and pay version of IntelliJ, but I find it to be faster, cleaner GUI, and has fewer bugs/really annoying quirks than Eclipse.
More on reddit.comRunning Java Program from Command Line Linux - Stack Overflow
Vim for Java?
Editing without an IDE could be a bit paiful at first sight, maybe you can have a look at this to setup some help http://www.averywagar.com/post/configuring-vim-for-java-development
More on reddit.comVideos
I'm so confused on how to get an IDE for Java on Linux. I'm using Linux mint and I have no idea if I have to download java or if it is already downloaded, I also don't know whether or not I need to download eclipse, but primarily I need to know how I can start practicing java programming on Linux.
I know programming and did a bit of Java before. Now I want to do serious development (for academic purposes, so not that large scale).
What's the best setup for Java on linux (ubuntu)? I remember from back in the days 3 or 4 flavours of Java co-existing on my system, and things not working terribly well.
Which flavour should I go for if I want to use Java professionally? How do I install it and make sure it's the main one used?
Is Eclipse still the best thing in town? (never liked it, always used gedit, but I guess I'll have to change my ways)
Would I use the same setup for writing smartphone apps? (as a hobby, not part of the job)
Thank you all in advance!
Update: Thanks a lot for all the detailed answers!
So it looks like the java situation got a bit better on linux, and openJDK is a solid version. Good to know.
IDE-wise: many votes for eclipse, but intelliJ and netbeans are good alternatives. I'll give each a go.
Android dev: Eclipse is preferable.
Also important point that is shared by many: get java from the repositories,but the IDEs directly from the original websites (easier to configure, up-to-date and less bloated).
I use Ubuntu/Mint with Oracle's JDK. IntelliJ for the IDE. There is both a free and pay version of IntelliJ, but I find it to be faster, cleaner GUI, and has fewer bugs/really annoying quirks than Eclipse.
I've been using Ubuntu and Java for about 6 years now at work. I do a combination of mobile, web, and server development. I've used JEE, Android, Spring, and hobbied in JavaFX (both 1.0 and 2.0). Here is the best I can come up with.
For the most part don't use the Ubuntu packages for anything but OpenJDK. Install Eclipse and/or Netbeans by hand. I like keeping everything in /opt with a symlink to the current version. (IE I will have /opt/tomcat-6 and /opt/tomcat-7 with /opt/tomcat pointing to tomcat 7. Same goes for Groovy, java FX, alternative JDKs, etc).
If you find yourself needing a specific JDK (Oracle 32 bit for Java FX as an example), you should use the alternatives system to point Ubuntu at it. As long as you make sure you get javac, java, and javah updated you will be golden. Eclipse et al behave correctly. Alternatively you can set this up per IDE. It really is a matter of preference.
Ever since OpenJDK got good, most of the problems we had with Java on Linux went away.
TL;DR; Eclipse and Netbeans are good enough. Install OpenJDK from apt and get everything else from the official build. Put everything you need in /opt and use the IDE's platform tools or the Alternatives system to make sure you are using the Java you want.
If your Main class is in a package called FileManagement, then try:
java -cp . FileManagement.Main
in the parent folder of the FileManagement folder.
If your Main class is not in a package (the default package) then cd to the FileManagement folder and try:
java -cp . Main
More info about the CLASSPATH and how the JRE find classes:
- How Classes are Found
- Setting the class path (Solaris/Linux)
- http://en.wikipedia.org/wiki/Classpath_(Java)
Guys let's understand the syntax of it.
If class file is present in the Current Dir.
java -cp . fileName
If class file is present within the Dir. Go to the Parent Dir and enter below cmd.
java -cp . dir1.dir2.dir3.fileName
If there is a dependency on external jars then,
java -cp .:./jarName1:./jarName2 fileName
Hope this helps.