• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finding a resource to learn Java fundamentals -- not Java code writing fundamentals.  RSS feed

 
Ben Warrick
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where can I learn the actual basics about Java? I don't mean the language. I'm a programmer and I use a lot of different languages. One of my favorites is Java, as long as you don't count the pain of setup and deployment.

My usual Java project goes something like this: I create a project in Eclipse, struggle to get all my libraries and .dlls working. This can take any amount of time. Once complete, I have a great time programming (Java is wonderful) until I need to deploy the program, especially on another machine. Deployment usually involves a lot of frantic web searches to understand errors and fix them, and all kinds of fooling around. I eventually get it working, but months later, I could never describe how, nor can I remember specifically how I got the initial project setup correctly. It's just a matter of fooling around with Eclipse. It's like I'm a super-genius programming in Java, but during setup and deployment I'm an idiot tapping things with a hammer and spraying WD-40 hoping I'll accidentally fix the issue.

I'd like to achieve some kind of fundamental understanding of Java so I can understand how, with or without an IDE, to make libraries and .dlls available to my code, and then make that code run on a JVM... I've tried finding some resource on this topic several times over the past year. I never find what I'm looking for. There are deployment guides. Those don't leave me any smarter, more confused. There are numerous tools, IDEs and tools like Gradle that I use, and guides for them. There are heaps of guides and help for writing Java code, OOP, etc., I don't need those.

I just feel like I'm missing an actual understanding of how Java works, and I'd like to find it. Any ideas?

Thanks.
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Learning any new language should not need an IDE. All you need is the Java SDK. Every code/program you write should be in Notepad or equivalent. Use the command prompt to compile, build jars, run programs etc.

Now when you mentioned java fundamentals, are you talking about syntax and API or concepts and terminology?

The Java Tutorial here is an excellent starting place.

Book like Head First Java 2e or Thinking in Java is another great starting place.
 
Les Morgan
Rancher
Posts: 779
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Warrick wrote:
... It's just a matter of fooling around with Eclipse. ...

Ben,
I am afraid your description of the problem is more accurate than you realize: the deployment tool is in your IDE not in Java. Eclipse is not doing what you need it to do to make your deployment package.

I have been banging around the Java community since about 1999, and I have never had the problems you describe. Some of my projects have been small, some have been quite large, but all have one thing in common: they have been fairly easy to deploy using the IDE we have chosen.

You need to spend some quality time with the instructions to Eclipse with emphasis on the deployment process and tool involved.
Les
 
Knute Snortum
Sheriff
Posts: 4276
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mention Gradle. This is excellent build management software, but just a thought: Maven comes integrated with the Eclipse IDE (you may have to install it. Look for M2E.) Maybe you'll have more luck with that.

But maybe you should start with just one problem you're having and describe it in detail. If it's not a Java problem, I'll move the thread to the appropriate forum.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben Warrick wrote:I'd like to achieve some kind of fundamental understanding of Java so I can understand how, with or without an IDE, to make libraries and .dlls available to my code, and then make that code run on a JVM.

Well, one possibility is to take a fairly straightforward project, deploy it, and then look at the jar, war or ear it produces.

All of them are simple archive files, and so can be inspected with most zip products or, on Unix/Linux, the tar or gzip utilities.

What you'll find inside is a directory structure, and I'm ashamed to say, I've forgotten all the ins and outs of it; but one important thing to know about is the manifest file, which may contain your .dll links (not sure, TBH). If you Google for something like "JAR contents", I suspect you'll find something to help.

However, that will show you how Eclipse does it. Other IDEs, or builders (like Maven), may take a slightly different approach. They're all likely to be similar though.

HIH

Winston
 
Ben Warrick
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies!

K. Tsang, I've been looking over the resource you suggest. Thanks.

Winston, that's a good idea. I think once I get back to my latest Java project I'll take some time to study things from the ground up.

My current project is a bit complicated. I built a desktop program with Java that consists mainly of a large image display that allows a pathologist to indicate areas of a biopsy image, which has a grid overlay. A main software component of the system is Open CV, a C library with Java extensions for image processing. The whole idea is to create a software system that is trainable by a pathologist to identify cancer, or at least screen images for suspicion. Experimenting with the desktop version is painfully slow. Processing the images, which are large, with machine learning algorithms takes a lot of time, like 10-20 minutes each depending on the PC, and we'd like to process images in the hundreds if not thousands.

Before implementing this system in Java, I did a proof of concept in .Net, which at the time was convenient for me. I was already developing other system with it then. I switched to Java for more flexibility for the actual system.

Currently I'm re-implementing the system to run on a web server using Spring Framework. I've begun the development on Eclipse with Gradle running on Windows. However, I plan to run the production system on a beefy Linux server with 64 CPU cores.

I've been rushing my way through most of these supporting technologies, more interesting in trying to understand the machine learning and image processing core of the system. However, I think it's good advice to focus on these supporting technologies, perhaps one at a time, building a simple example, and studying it until I no longer feel like a moron with a hammer and can of WD-40.

 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OpenCV...Processing the images, which are large, with machine learning algorithms takes a lot of time, like 10-20 minutes each depending on the PC, and we'd like to process images in the hundreds if not thousands. ...Currently I'm re-implementing the system to run on a web server...plan to run the production system on a beefy Linux server with 64 CPU cores.


JNI (Java Native Interface) is what the OpenCV java wrapper uses to talk to its native libraries. The only comprehensive resource on this topic still remains Sheng Liang's 15 year old book, and it's still relevant because the JNI interface has hardly changed in all these years. It's available both as a HTML guide and as a published book.

As for deploying native libraries in a web container on Linux, you just have to set an environment variable - LD_LIBRARY_PATH - to the directory where all the .SO files are present. This is usually done in the container's startup scripts. This is one step that is not required in Windows, where setting PATH is enough for the loader.
Another aspect to keep in mind is that web servers are multi threaded by default, and both JNI and OpenCV have some gotchas in multithreaded environments. You may have to dig into OpenCV's source code now and then just to ensure things like shallow cloning and reference counting are actually thread safe.

Not directly related to original question, but if you want to do image processing at scale using OpenCV, you're better off using a server with Nvidia GPUs. OpenCV supports Nvidia's CUDA APIs, and vectorized operations on GPUs beat many-core-CPU systems by an order of magnitude. AFAIK, even with latest 3.x version, you have to build OpenCV from source for GPU support, and you have to write your own JNI wrapper functions to use it because opencv's java API doesn't include GPU related bindings.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!