• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Learning java... impossible?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So here is where I'm stuck. I've finished a java class and finished the book. I said to myself, "That was a fun class, let's try to keep going." I then go on github and start looking at java projects, and it seemed to me that they must all have learned some completely different java than me. All the programs I write have a .class file and a .java file. Can some one please explain to me how these project files are all comprised of files I've never seen, and why when I look at "beginner forums" I don't understand any of the questions being asked by my fellow "begginers"? What are you guys doing to learn how to create java projects on github and learning how to actually use java to help with projects others are doing online? In other words what do I do after having read this beginner book ? Thank you for reading.
 
Saloon Keeper
Posts: 13985
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

It's hard to give you an answer to your question without knowing what the things are you haven't seen before, or what questions confuse you.

A good way to start though, is to start by setting a goal for yourself. Some sort of application you want to make. You will get stuck along the way many times, and asking questions on how to continue will make you learn.
 
Sheriff
Posts: 7113
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

I agree with Stephan: pick something to code that you're interested in, or if you're having trouble thinking of something, try creating a Tic Tac Toe game, or a simple calculator, or an ATM -- anything like that.
 
Rancher
Posts: 259
13
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there's definitely a lot more to learn which might not even be a part of java, but java developers are routinely using. git, maven, spring, javaFX, guava, servlets, kotlin. all kinds of stuff. i think this is what makes it really hard to get into working on existing projects, they use all this extra stuff.
 
Bartender
Posts: 383
47
Firefox Browser MySQL Database Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I learning Java impossible? Definitely not. I suspect that you are not so far off as you think, but you have been learning using an IDE, where you don't know what is actually happening when you click the buttons to compile, run, etc. Maybe as a start you could write, compile and run a Hello World program from the command line.

Do you know how to do this? If you need pointers, here is a good guide that will also give you a little theory on how Java works: https://docs.oracle.com/javase/tutorial/getStarted/cupojava.

But the way, which book did you work through?
 
Rancher
Posts: 1029
27
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sage Clark wrote:So here is where I'm stuck. I've finished a java class and finished the book. I said to myself, "That was a fun class, let's try to keep going." I then go on github and start looking at java projects, and it seemed to me that they must all have learned some completely different java than me. All the programs I write have a .class file and a .java file. Can some one please explain to me how these project files are all comprised of files I've never seen, and why when I look at "beginner forums" I don't understand any of the questions being asked by my fellow "begginers"? What are you guys doing to learn how to create java projects on github and learning how to actually use java to help with projects others are doing online? In other words what do I do after having read this beginner book ? Thank you for reading.



Sage,

I suggest you get a good IDE, my preference is NetBeans but there are many, and start using it.  The .java files are your source, your .class files are those .java files ran through the compiler to produce byte code.  In your IDE you can get a better look at what is happening, if you want to do so, but more importantly you get and editor, compiler, debugger, and JAR product all in one.

There are several books out there and even free ones, Thinking in Java is free and is still valid for the core Java language.

The book and class that you took was, IMO, a miserable failure if you have done that much Java study and do not know the basics yet.  Get the IDE and a good basic book, like the one I mentioned, and start doing the examples.

Another good place to go it the Java Tutorials over on Oracle.

Les
 
Saloon Keeper
Posts: 25634
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm a little bit worried about how you could take a "java class" and not know what a .java file is. That's sort of the whole starting point. The only way you could "learn java" and not know what a ".java" file is is if the course was extremely superficial and covered only the Java language as an abstraction.

Java is learned and used by countless people everyday, even though some use it badly. Which is hardly a java-only problem. But it's a professional-grade platform and with great power comes great demands. Some languages, like PHP, you can just create a file, slap it into a directory in a webserver and go. In Java, any program of even moderate complexity is going to require you to know how to set up and build an executable module from scratch - or at least by stealing enough parts from an existing project. And in that event, you still have to know what to steal.

I think maybe you need to take a more in-depth Java course.
 
Jesse Duncan
Bartender
Posts: 383
47
Firefox Browser MySQL Database Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jj Roberts wrote:I learning Java impossible? Definitely not...

Sorry, I misread your post. I thought you were saying that other projects are made up of .java and .class files. As S Fox pointed out, projects online could have a lot more to them than vanilla Java.
 
Marshal
Posts: 75839
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But you can get a long way without using other tools.
I think the true situation is that Java┬« is very easy to learn, but programming is difficult, which is why Tim H said it is often used badly. Tim did say, “program of even moderate complexity”, which leads me to believe the best advice for a beginner is, “keep it simple”.
Write a class representing a kettle. Give it a temperature field. Get it to set the temperature to hot (=boiling) and cold (=room“temperature) with two methods, heat() and cool() or similar. Get that working, and for the time being, nothing else. Work out how that works. Then you can enhance the kettle in all sorts of ways. Show us what you have got so far.
 
Ranch Hand
Posts: 128
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would suggest that you use normal notepad and use the command line. Don't use the IDE until you are able to figure how to compile the program on the command line.
It will help clear a lot of things by the time you switch to the IDE.
 
Campbell Ritchie
Marshal
Posts: 75839
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joseph Mokenela wrote:. . . normal notepad . . . .

Not MS NotePad please. It has some bad habits which make programming more difficult. Use something like NotePad++, which has options like automatic indentation to make programming easier. The text editors built in to Linux/Unix/Mac boxes are good, however.much better
 
Les Morgan
Rancher
Posts: 1029
27
Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been teaching others to program for over 30 years now, and Java since 1999, I've not seen anyone that has been a better programmer by starting out doing everything manually/commandline and using a text editor; in many cases they become so frustrated to the point of getting mental blocks from the stress of not seeing everything working together and having to do each step individually and having to configure each step.

IMO: get the IDE... "hello world" and etc works seconds after your IDE is installed, the mechanics of how things are done are still there and easily investigated using the file browser.  You also gain the feature of having an integrated debugger, and truthfully, in over 30 years of this stuff, most peoples' problems could have been solved with 15 to 30 seconds of debugger work.  So for all the good intents on getting someone more "technically inline", just get the debugger and have a much easier time learning Java.

BTW: I learned commandline Java compiling from the .java file and JAR-ing from the .class files, and building the manifest for the executable JAR files... get the IDE, it is way better--especially when you are starting out. (Oh, and don't forget the commandline degger too!)
 
Rancher
Posts: 98
4
VI Editor Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would still advise at least try at some point to use command line and steps of compiling/running manually. Especially for simple 'hello world' programs, as the additional work in comparison with IDE there is minimal. I can imagine also setting up IDE can be sometimes cumbersome and demotivational for early beginner. I can't help myself, I think it is very beneficial to understand things done in the background by IDE (and possibly build tool) for you and not be fully dependent on it. Once you appear in the situation you won't have it at your disposal and you'll have to change some code/refactor/recompile/package, you'll have at least better basis how to proceed.
 
Tim Holloway
Saloon Keeper
Posts: 25634
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried to learn several technologies by using an IDE and its built-in wizards. It was a spectacular disaster because everything was a black box and I couldn't tell what what where, what it was doing or how to change it to do what I actually wanted.

Well, more precisely, I tried this two or three times using different IDEs and different coding wizards.

The "notepad*-and-command-line" approach may seem crude, but because there is absolutely nothing between you and the process, you are forced to learn the process and to understand it. Conversely, here on the Ranch, we get quite a few questions of the "I created a Web Project my files don't work" or "I built this and I get a ClassNotFound". An IDE allows you to skip or at best lightly touch some basic concepts and it's a lot harder to learn something if you start in the middle.

Command line itself is not going away. All of my production servers are command-line only. Adding a GUI interface to a Linux system sucks up about 100MB of RAM that could be doing more productive things, since I only talk to the OS when I need to do upgrades, installations and repairs. All of my production app builds and deployments are command-line only. I got burned very, very badly a number of years ago because an app failed, needed a 1-line code change, and the only way to build it was to resurrect an obsolete version of Microsoft Visual Studio and apply service packs first. For a sweaty short interval, I was seriously worried that I was going to have to nuke a hard drive, install an obsolete copy of Windows NT and install services packs for it in order to run the obsolete Visual Studio.

And that's not even counting the utility of command line for applications themselves. Very few GUI "scripting" systems last for long.

On the other hand, Java is a complex ecosystem and you don't want to use notepad-and-command-line once you start getting up to speed. You can still use Notepad if you must, but a proper build tool like Maven, Ant or Gradle is much better at ensuring that the build is done properly and everything gets put where it should be.

And I given a choice, I would prefer an IDE. An IDE can do refactoring much easier than a straight text editor can, usually has a graphical debugging interface, pop-up help, interactive error highlighting, code completion and many more amenities. I just expect to use it intelligently, not simply DDD (drag, drop, drool).

---
*Yes, I know, actually using Windows Notepad, especially versions from the old days could get you in trouble itself thanks to the way it handled end-of-line sequences. I'm speaking of generic minimalistic text editors in general, not Notepad specifically. Use EDLIN, instead.
 
reply
    Bookmark Topic Watch Topic
  • New Topic