Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Java ide

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am very new to Java. I am trying to find an ide to write java code without a lot of figuring out how to  get the ide to work. I have tried IntelliJ. I got one program to work. I am reading Learning Java and java in a nutshell. When I tried to write a modified code I could not. I have also tried BlueJ. Couldn't even write code. I tried getting netbeans. Could not find a download. I went to netbeans site. Right now I am about to try greenfoot.  I think there were a few others but I don't remember.

Mark
 
Saloon Keeper
Posts: 14088
319
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm very partial to NetBeans.

The NetBeans installers can be found here: https://netbeans.apache.org/download/nb14/nb14.html

Look for the bulleted list under Installers. The color scheme makes it difficult to see the difference between hyperlinks and plain text, but maybe that's just me.

Do you already have experience in building Java applications using just the command line? Maybe your difficulty could be related to not knowing how the IDE invokes the tools provided by the JDK?
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to java. I am going to be taking a class in java, python, and php.
My problem is that Java is new to me and the ide's seem to be frustrating and very difficult. I have used PHP ides and don't have any problems with that. I use notepad++ for php. Very easy.
Right now I am trying to get a grasp of java before I start classes in school. By the way the netbeans website does not allow for downloading Netbeans. I spent 15 minutes trying to download Netbeans. Never mind I found a link that works.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK I downloaded Netbeans. I don't know how to use it to write code though.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,
I wrote some code into Eclipse. No typos. I cannot run the file. I get an error that says the selection cannot be launched, there are no recent launches. What do I do?
Mark
 
Sheriff
Posts: 6962
2
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to run some Java code, first it needs to have a "main" method.



If you class has a main method, you can run it in Eclipse by right clicking on the class name in the "Package Explorer" at the left of the screen, and selecting Run As -> Java Application.
 
Stephan van Hulst
Saloon Keeper
Posts: 14088
319
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But seriously, use the command line tools before you use an IDE. You will then form a much greater understanding for what happens behind the scenes when you eventually use an IDE.

Do you know what a compiler is?
 
Saloon Keeper
Posts: 25816
184
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
Note: this thread parallels a similar one: https://coderanch.com/t/753359/ide/type-code-eclipse

If you're still learning Java then it may be too soon to start learning an IDE. IDEs are very complex environments and they can actually interfere with learning how to design and code when you're not yet comfortable with a language and its runtime environment.

First, a note on building. For beginner projects a simple command line or batch script will generally do. As you develop, however, you need a build tool that understand's Java's particular quirks and needs. Although there are several, Maven is about the most commonly-used. Maven encourages a standardized project organization, although I myself was slow to adopt it because it's "magic". Maven is based on goals and there's no way to list what goals a given project requires. You just have to learn the ones you'll need. But that's not as hard as it seems. Maven is a useful skill since many IDE projects themselves use Maven to build with.

Now for editing. The best start is, as we often say, Windows Notepad (or your chosen OS equivalent). It's vanilla text editing with no special support for Java or any other programming language.

The next step up is a "smart" editor. Some of the fancier editing systems have different edit modes that can do things like highlight different language elements, automatically suggest text based on context and so forth. The Emacs text editor is a common favorite, although it has often been described as "an operating system that's only pretending to be a text editor*" and it was designed for keyboards that have extra shift keys that have to be faked on PC keyboards. So while actual text entry is simple, the emacs commands are tied to a bewildering array of CTRL, SHIFT and META (META???   ). Plus Super and Hyper, but we don't talk about Super and Hyper. Oh, and you can customize Emacs. By writing add-ons in LISP.   Which is what they did to create the Emacs Java-mode plugin.

On the other end of the battlefield is the "vi" editor and its derivatives such as vim.  Emacs works in data input mode by default. The vi editor, on the other hand, works in command mode by default. While vi doesn't use a lot of function keys, if you sneeze while in command mode, you've probably accidentally typed in a command sequence with horrible consequences. While many über-geeks swear by vi, ordinary people will probably find it intimidating. But it is a very good option if you're connected to your computer via a 300-baud modem terminal line.

And there are lots of other smart editors around, although I mentioned Emacs and vi because they're available for virtually all Unix and Linux distros.

Once you're comfortable with the language, editing and build, then you're ready to move up to an actual IDE.

IDE stands for Intelligent Development environment. It combines smart editing and build support with test and debugging. The heart of virtually every IDE system is the project, and you can create projects using the IDE command system (such as File/New Project Menu) or import existing projects. Although many IDEs support a flexible directory structure, they also support Maven project structure, so that as you move up you don't have to re-design your Maven projects. In fact, the Maven goal "eclipse:eclipse" when run against a Maven project will automatically create Eclipse metadata for the project. There's also a Maven goal for IntelliJ, which is, unsurprisingly, "intellij:intellij". You can even run both, since the metadata for Eclipse and IntelliJ are in different forms that don't interfere with each other.

The main things you'll see in an IDE is that you have a GUI browse function for your projects, and the editors are very smart indeed, where often they will provide code auto-completion and instant feedbacks on coding errors. Debugging is typically done by creating a run profile that you'll execute to either spin an internal debugging session or to attach to a remote debugging session; the actual debugger for Java is built into every JVM so the IDE's just connect and talk to it in GUI fashion.

===
*Some die-hards really so spend their entire lives in Emacs. It not only edits text, it has web browsing and email capabilities. And a good game of Tetris.
 
Author
Posts: 211
10
Scala IntelliJ IDE Netbeans IDE Python Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:But seriously, use the command line tools before you use an IDE. You will then form a much greater understanding for what happens behind the scenes when you eventually use an IDE.



As a counterpoint, from a teacher's perspective I must entirely disagree. For sure you'll want to know this stuff in due course, certainly before you consider applying for a job, but since it's clear you're a complete beginner, your best route for starting is the one that has you *succeeding* as soon as possible. There's a *ton* of stuff for you to learn eventually, and you need to pick a path through the woods that doesn't take a detour at every weed and cross track.

Take a stroll around youtube and look for some getting started videos using the IDE that you're looking at. The IDE stuff isn't hard, but you'll benefit from a walkthrough showing the ideas of making a project, then making a class, in a package, within that project. Then in the class, you can create a main method, and there, you can write "hello world".

Words are not a great way to describe visual actions on a user interface, sadly. Of course, the UI changes a bit from time to time, so be careful that you don't have too old of a video.

Good luck
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank Carver wrote:If you want to run some Java code, first it needs to have a "main" method.



If you class has a main method, you can run it in Eclipse by right clicking on the class name in the "Package Explorer" at the left of the screen, and selecting Run As -> Java Application.


Yes the code from the book Learning Java has a main.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:But seriously, use the command line tools before you use an IDE. You will then form a much greater understanding for what happens behind the scenes when you eventually use an IDE.

Do you know what a compiler is?


I have no idea how to run a java program from the command line. Right now I think I might be better off using an ide.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Note: this thread parallels a similar one: https://coderanch.com/t/753359/ide/type-code-eclipse

If you're still learning Java then it may be too soon to start learning an IDE. IDEs are very complex environments and they can actually interfere with learning how to design and code when you're not yet comfortable with a language and its runtime environment.

First, a note on building. For beginner projects a simple command line or batch script will generally do. As you develop, however, you need a build tool that understand's Java's particular quirks and needs. Although there are several, Maven is about the most commonly-used. Maven encourages a standardized project organization, although I myself was slow to adopt it because it's "magic". Maven is based on goals and there's no way to list what goals a given project requires. You just have to learn the ones you'll need. But that's not as hard as it seems. Maven is a useful skill since many IDE projects themselves use Maven to build with.

Now for editing. The best start is, as we often say, Windows Notepad (or your chosen OS equivalent). It's vanilla text editing with no special support for Java or any other programming language.

The next step up is a "smart" editor. Some of the fancier editing systems have different edit modes that can do things like highlight different language elements, automatically suggest text based on context and so forth. The Emacs text editor is a common favorite, although it has often been described as "an operating system that's only pretending to be a text editor*" and it was designed for keyboards that have extra shift keys that have to be faked on PC keyboards. So while actual text entry is simple, the emacs commands are tied to a bewildering array of CTRL, SHIFT and META (META???   ). Plus Super and Hyper, but we don't talk about Super and Hyper. Oh, and you can customize Emacs. By writing add-ons in LISP.   Which is what they did to create the Emacs Java-mode plugin.

On the other end of the battlefield is the "vi" editor and its derivatives such as vim.  Emacs works in data input mode by default. The vi editor, on the other hand, works in command mode by default. While vi doesn't use a lot of function keys, if you sneeze while in command mode, you've probably accidentally typed in a command sequence with horrible consequences. While many über-geeks swear by vi, ordinary people will probably find it intimidating. But it is a very good option if you're connected to your computer via a 300-baud modem terminal line.

And there are lots of other smart editors around, although I mentioned Emacs and vi because they're available for virtually all Unix and Linux distros.

Once you're comfortable with the language, editing and build, then you're ready to move up to an actual IDE.

IDE stands for Intelligent Development environment. It combines smart editing and build support with test and debugging. The heart of virtually every IDE system is the project, and you can create projects using the IDE command system (such as File/New Project Menu) or import existing projects. Although many IDEs support a flexible directory structure, they also support Maven project structure, so that as you move up you don't have to re-design your Maven projects. In fact, the Maven goal "eclipse:eclipse" when run against a Maven project will automatically create Eclipse metadata for the project. There's also a Maven goal for IntelliJ, which is, unsurprisingly, "intellij:intellij". You can even run both, since the metadata for Eclipse and IntelliJ are in different forms that don't interfere with each other.

The main things you'll see in an IDE is that you have a GUI browse function for your projects, and the editors are very smart indeed, where often they will provide code auto-completion and instant feedbacks on coding errors. Debugging is typically done by creating a run profile that you'll execute to either spin an internal debugging session or to attach to a remote debugging session; the actual debugger for Java is built into every JVM so the IDE's just connect and talk to it in GUI fashion.

===
*Some die-hards really so spend their entire lives in Emacs. It not only edits text, it has web browsing and email capabilities. And a good game of Tetris.


I wasn't sure that my first post was posted. This one is getting more useful action. Right now I am not interested in command line anything. Sounds more difficult since I have no idea how to run java code in the command line.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark Roberge wrote:

Tim Holloway wrote:Note: this thread parallels a similar one: https://coderanch.com/t/753359/ide/type-code-eclipse

If you're still learning Java then it may be too soon to start learning an IDE. IDEs are very complex environments and they can actually interfere with learning how to design and code when you're not yet comfortable with a language and its runtime environment.

First, a note on building. For beginner projects a simple command line or batch script will generally do. As you develop, however, you need a build tool that understand's Java's particular quirks and needs. Although there are several, Maven is about the most commonly-used. Maven encourages a standardized project organization, although I myself was slow to adopt it because it's "magic". Maven is based on goals and there's no way to list what goals a given project requires. You just have to learn the ones you'll need. But that's not as hard as it seems. Maven is a useful skill since many IDE projects themselves use Maven to build with.

Now for editing. The best start is, as we often say, Windows Notepad (or your chosen OS equivalent). It's vanilla text editing with no special support for Java or any other programming language.

The next step up is a "smart" editor. Some of the fancier editing systems have different edit modes that can do things like highlight different language elements, automatically suggest text based on context and so forth. The Emacs text editor is a common favorite, although it has often been described as "an operating system that's only pretending to be a text editor*" and it was designed for keyboards that have extra shift keys that have to be faked on PC keyboards. So while actual text entry is simple, the emacs commands are tied to a bewildering array of CTRL, SHIFT and META (META???   ). Plus Super and Hyper, but we don't talk about Super and Hyper. Oh, and you can customize Emacs. By writing add-ons in LISP.   Which is what they did to create the Emacs Java-mode plugin.

On the other end of the battlefield is the "vi" editor and its derivatives such as vim.  Emacs works in data input mode by default. The vi editor, on the other hand, works in command mode by default. While vi doesn't use a lot of function keys, if you sneeze while in command mode, you've probably accidentally typed in a command sequence with horrible consequences. While many über-geeks swear by vi, ordinary people will probably find it intimidating. But it is a very good option if you're connected to your computer via a 300-baud modem terminal line.

And there are lots of other smart editors around, although I mentioned Emacs and vi because they're available for virtually all Unix and Linux distros.

Once you're comfortable with the language, editing and build, then you're ready to move up to an actual IDE.

IDE stands for Intelligent Development environment. It combines smart editing and build support with test and debugging. The heart of virtually every IDE system is the project, and you can create projects using the IDE command system (such as File/New Project Menu) or import existing projects. Although many IDEs support a flexible directory structure, they also support Maven project structure, so that as you move up you don't have to re-design your Maven projects. In fact, the Maven goal "eclipse:eclipse" when run against a Maven project will automatically create Eclipse metadata for the project. There's also a Maven goal for IntelliJ, which is, unsurprisingly, "intellij:intellij". You can even run both, since the metadata for Eclipse and IntelliJ are in different forms that don't interfere with each other.

The main things you'll see in an IDE is that you have a GUI browse function for your projects, and the editors are very smart indeed, where often they will provide code auto-completion and instant feedbacks on coding errors. Debugging is typically done by creating a run profile that you'll execute to either spin an internal debugging session or to attach to a remote debugging session; the actual debugger for Java is built into every JVM so the IDE's just connect and talk to it in GUI fashion.

===
*Some die-hards really so spend their entire lives in Emacs. It not only edits text, it has web browsing and email capabilities. And a good game of Tetris.


I wasn't sure that my first post was posted. This one is getting more useful action. Right now I am not interested in command line anything. Sounds more difficult since I have no idea how to run java code in the command line.




I have Visual Studio that I was using to learn C++. I haven't found a good book to learn visual c++. I am not interested in anything unix/linux. I haven't used any *nix systems in years. Not since I was working with comptuers. I am retired. Looking for ways to make some extra cash.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark Roberge wrote:

Stephan van Hulst wrote:But seriously, use the command line tools before you use an IDE. You will then form a much greater understanding for what happens behind the scenes when you eventually use an IDE.

Do you know what a compiler is?


I have no idea how to run a java program from the command line. Right now I think I might be better off using an ide.


Yes I know what a compiler is, c++ uses one. Java is a combo platter with interpreter/compiler.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank Carver wrote:If you want to run some Java code, first it needs to have a "main" method.



If you class has a main method, you can run it in Eclipse by right clicking on the class name in the "Package Explorer" at the left of the screen, and selecting Run As -> Java Application.



I got to the run configuration and clicked on java application. It [javadoc]hellojava2, I don't know if I am doing this right but here is my code.

I clicked on some stuff in the run configuration and don't know if I did it right. Running Java is very frustrating. I still can't get my code to run. I need some more specific details. Why can't developers make something more useable for beginners? Why does this language have to be so difficult?
 
Frank Carver
Sheriff
Posts: 6962
2
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please enclose all code examples in code tags so they are readable.  I have done this for you this time, but it's up to you from now on.

As for your code,. there are still several errors in this class, so you won't be able to run it until it compiles correctly.

Please double-check everything from the original source code, paying particular attention to capital letters and brackets.

When you have no more red error markers you should be able to run your class.

Note, however, that this class references another class HelloComponent2 which you have not included. Without that class your code will not be able to run, either.

In general, you are better trying something such as the classic "hello world" class to test that you understand how to use the tools and can enter, build, and run code successfully. Only then move on to more complex techniques such as graphical interfaces.
 
Marshal
Posts: 27285
87
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the place you got that from claimed it was suitable for raw beginners then they were not telling the truth. JFrame is not for beginners.

I'm not going to take the time to search for beginner tutorials but I'm sure that better ones than that one exist.
 
Simon Roberts
Author
Posts: 211
10
Scala IntelliJ IDE Netbeans IDE Python Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since you're starting from scratch, you have many unrelated things getting in your way at the same time. This is a bit dated, but the key concepts haven't changed at all (they've been added to, but you can ignore the new stuff while you're starting). This was written for an older version of netbeans, but I think you'll have a fighting chance of following it through to a first success:

https://docs.oracle.com/javase/tutorial/getStarted/cupojava/index.html
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank Carver wrote:Please enclose all code examples in code tags so they are readable.  I have done this for you this time, but it's up to you from now on.

As for your code,. there are still several errors in this class, so you won't be able to run it until it compiles correctly.

Please double-check everything from the original source code, paying particular attention to capital letters and brackets.

When you have no more red error markers you should be able to run your class.

Note, however, that this class references another class HelloComponent2 which you have not included. Without that class your code will not be able to run, either.

In general, you are better trying something such as the classic "hello world" class to test that you understand how to use the tools and can enter, build, and run code successfully. Only then move on to more complex techniques such as graphical interfaces.


Hello was the first program. That one ran fine in IntelliJ. I went to the books code website. There is a lot of different things going on with that. I am going to try the websites code and see what happens with that.

I'm not sure if I am getting the code insertion correctly.
I am writing the code from the books website and the ide does not like the following: The code is an exact copy. I saw the red x and I know those are commands that the ide does not like. So far all of the code I write in the eclipse ide is coming up with red x's.
 
Tim Holloway
Saloon Keeper
Posts: 25816
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, Simon. I've had IDEs really screw me up when I didn't know what was going on. In particular IDE "wizards" are very good about generating code that does things I don't understand - unless I learned the code first. That ends up with me going down false trails and eventually spending time unlearning things I never should have learned.

Personally, I absolutely abhor sites where they teach you stuff in terms of whatever pet IDE they prefer, despising it only second to videos where a text walk-through would be quicker — and easier to review. Videos to me are often a crutch used by people too lazy to sit down and write things out.

Also, mark, please don't quote entire messages. It's a waste of space and makes posts harder to read. If you quote, quote the specific items you're referring to.
 
Mark Roberge
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Simon Roberts wrote:Since you're starting from scratch, you have many unrelated things getting in your way at the same time. This is a bit dated, but the key concepts haven't changed at all (they've been added to, but you can ignore the new stuff while you're starting). This was written for an older version of netbeans, but I think you'll have a fighting chance of following it through to a first success:

https://docs.oracle.com/javase/tutorial/getStarted/cupojava/index.html



I already wrote code for a simple hello java.
Step 2 is to write code in a window that does essentially the same thing . While writing the code from the books website I am getting red square and round x's.


"GOOD NEWS"  I got it to run by doing a line by line comparison of the book code on the website and what I wrote in Eclipse.
Thanks for all of the help!
 
Frank Carver
Sheriff
Posts: 6962
2
Eclipse IDE Debian Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The code is an exact copy



If the code you originally posted is an exact copy, as in you used the copy-paste function from your web browser, I would stop looking at that website immediately. It is not valid Java.

If, however, you read it and typed it in yourself, then you need to get used to paying very close attention and double-checking everything.

Capital letters and spaces in names are very important
Where you place your brackets is very important, as is the type of brackets you use.
In Java, the filename must be exactly the same as the name of the class (but with .java added)

As everyone else is saying, you need to take one small step at a time and make sure you completely understand that before moving on. In this case that means starting with a very simple, completely self-contained class and making sure you can get that working before you move on to anything else.  Try this one:


  • Create a package named example
  • Create a class named HelloWorld in that package
  • Paste the code above into your new class, overwriting anything which is there already.


  • If you have done that correctly, you should have a class with no red errors.
  • Run that class by right-clicking on the class name in the Package Explorer and selecting Run As -> Java Application.
  • Check that the console panel at the bottom of the IDE says Hello, World.


  • Only when you have that working should you consider trying anything more complicated.
     
    Mark Roberge
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    One last thing, where do I find the compiled code I just wrote and what do I double click on?
     
    Frank Carver
    Sheriff
    Posts: 6962
    2
    Eclipse IDE Debian Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    If your code was compiled by Eclipse it will be in the "bin" folder inside the project, which will itself be inside the Eclipse workspace folder in your home directory.

    If you are working with Eclipse, though, by far the most sensible way to run your code is to get Eclipse to run it, as I suggested in my previous post!

    Much later, when you have a completed and tested application, you can export it as an executable jar file so that other people can run it without Eclipse.

    Seriously, though, one small step at a time.
     
    Tim Holloway
    Saloon Keeper
    Posts: 25816
    184
    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

    Frank Carver wrote:If your code was compiled by Eclipse it will be in the "bin" folder inside the project, which will itself be inside the Eclipse workspace folder in your home directory.



    Depending on how your project was generated. An Eclipse project definition determines the directories for source and binary files. Maven projects, for example, define /src/main/java and /src/test/java as source directories and /target as the directory where compiled classes and other resources are placed for assembly.

    Also a note on class/file naming. First, a java source file must be located in a directory subtree that exactly matches the name of the package that that class is defined for. So, for example, class "MyClass" with a package spefication of "com.coderanch.testing" would have to be located at "com/coderanch/testing/MyClass.java".

    Secondly, and very importantly, while some OS filesystems (such as Microsoft Windows) are fairly lax about upper/lower case in filenames, Java itself is not.. So you cannot name a file "com/coderanch/testing/myClass.java" for a class named MyClass and not have problems.
     
    Mark Roberge
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Frank Carver wrote:If your code was compiled by Eclipse it will be in the "bin" folder inside the project, which will itself be inside the Eclipse workspace folder in your home directory.

    If you are working with Eclipse, though, by far the most sensible way to run your code is to get Eclipse to run it, as I suggested in my previous post!

    Much later, when you have a completed and tested application, you can export it as an executable jar file so that other people can run it without Eclipse.

    Seriously, though, one small step at a time.



    OK
     
    Mark Roberge
    Ranch Hand
    Posts: 61
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Frank Carver wrote:

    The code is an exact copy



    If the code you originally posted is an exact copy, as in you used the copy-paste function from your web browser, I would stop looking at that website immediately. It is not valid Java. I am talking about the book's website where the author has written working Java code.

    If, however, you read it and typed it in yourself, then you need to get used to paying very close attention and double-checking everything.
    This is what I am doing

    Capital letters and spaces in names are very important
    Where you place your brackets is very important, as is the type of brackets you use.
    In Java, the filename must be exactly the same as the name of the class (but with .java added)

    As everyone else is saying, you need to take one small step at a time and make sure you completely understand that before moving on. In this case that means starting with a very simple, completely self-contained class and making sure you can get that working before you move on to anything else.  Try this one:

    [code=java]package example;

    public class HelloWorld {
       public static void main(String[] args) {
           System.out.println("Hello, World");
       }
    }

    Only when you have that working should you consider trying anything more complicated.



    I am reading the book Learning Java the author is moving at a good pace and covering the code that I was trying to make it work.
     
    Tim Holloway
    Saloon Keeper
    Posts: 25816
    184
    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

    Tim Holloway wrote:
    Also, mark, please don't quote entire messages. It's a waste of space and makes posts harder to read. If you quote, quote the specific items you're referring to.

     
    Sheriff
    Posts: 8324
    594
    Mac OS X VI Editor BSD Linux
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark Roberge wrote:

    Stephan van Hulst wrote:But seriously, use the command line tools before you use an IDE. You will then form a much greater understanding for what happens behind the scenes when you eventually use an IDE.

    Do you know what a compiler is?


    I have no idea how to run a java program from the command line. Right now I think I might be better off using an ide.


    Ok, you should stop going in circles. [1] I don't know how to use command line; [2] I might be better off using an IDE; [3] I don't know how to use an IDE.

    I personally started with command line (and glad I did that), that gave me a good initial understanding what the source code is, what the compiler is, what the compiled class is. How to execute it.

    No one says you should do that for a long time (i.e. 6 months), maybe a week or month is enough, depending how much you practice in that month.

    Here is the tutorial you can start with: https://www.oracle.com/java/technologies/compile.html Looks better written than many of those blogs out there, which contain a lot of mistakes.
     
    Marshal
    Posts: 76079
    362
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark Roberge wrote:. . . Step 2 is to write code in a window that does essentially the same thing . . . .

    Which book? I am not quite sure about recommending you move on to GUIs at such an early stage.

    Thanks for all of the help!

    I didn't help you myself, but (on other people's behalf) . . . “that's a pleasure.”
     
    Tim Holloway
    Saloon Keeper
    Posts: 25816
    184
    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

    Campbell Ritchie wrote:I am not quite sure about recommending you move on to GUIs at such an early stage.



    Desktop GUI apps are so last millennium. For most of us, it's not worth the trouble to learn Swing, SWT or any of the other Java GUI frameworks.

    These days Java apps are almost always either basic command-line apps or they are webapps.  Spring Boot is popular for desktop-based webapps, although that's a REALLY advanced subject, and I'd recommend starting out with just basic webapps to start with.

    There are a few GUI desktop apps written in Java, but not many. Many of the Java IDEs are written in Java, including Eclipse and IntelliJ. Netbeans, too, if I'm not mistaken. I know of a very good GUI utility for working with Java keystores, another for doing Gantt-chart based project work, a video editor that puts the lie to anyone's claims that Java is "slow", and a UML design tool. And possibly my favorite: the FreeMind mind-mapper. Though all of these were originally written long ago and some receive more ongoing maintenance than others.

    Not long ago I had to deal with "software rot". Don't ever believe anyone who says that once a program has been written it can run forever. The app in question was a GUI desktop app called the Gourmet Recipe Manager. It was written in Python. The problem is, many of the major subsystems — including the Python language itself kept breaking and eventually the application's author just couldn't dedicate enough resources to keep it up to date. By "breaking", I mean that things like the database API (sorcercy) and most recently, the Gnome API. Software rots. Not from the inside out, but from the outside in.

    I looked at the Gourmet source code and decided that the GUI/language changes were so much work that it would be easier to just re-create the whole system in Java. Java historically has been very resistant to age/technology-related breakage, having a mindset and mechanisms actually designed into the language itself. With some exceptions (Looking at you, Android!). So I re-designed it to use the same database but a Spring Boot UI and open-sourced it. https://gogs.mousetech.com/mtsinc7/GourmetJ-Springboot This runs both on the desktop and deployed to a server (Demo at https://gourmetj.mousetech.com - ignore the "invalid certificate" warning).
     
    Greenhorn
    Posts: 29
    Firefox Browser Java Windows
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Mark Roberge wrote:I am new to java. I am going to be taking a class in java, python, and php.
    My problem is that Java is new to me and the ide's seem to be frustrating and very difficult. I have used PHP ides and don't have any problems with that. I use notepad++ for php. Very easy.
    Right now I am trying to get a grasp of java before I start classes in school. By the way the netbeans website does not allow for downloading Netbeans. I spent 15 minutes trying to download Netbeans. Never mind I found a link that works.



    I would just stick with Notepad++ for Java then. You get some syntax highlighting but not much else. Head First Java recommends starting with a text editor as well.

    Don't worry about using the command line either. For a beginning Java class you'll mostly just compile and run your programs. Nothing fancy.
     
    Rancher
    Posts: 1041
    27
    Netbeans IDE Oracle MySQL Database Tomcat Server C++ Java
    • Likes 2
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    i have been using netbeans since 1998?  maybe 1999, the one thing that i found best about it is that i could code using it from the very first minute that i put it on my box, the very next thing i noticed was that it has an integrated debugger that has served me well over the years, the 3rd thing i found was don't use the GUI generator, the code generator, unless you know how to do it manually to start--but when you know how to do it manually, you definitely will not use the code generator--so catch 22 there.  I have tried many others, but netbeans has always been the easiest to use and to get my programmers up and contributing as fast as possible, and yet, let them develop complex solutions.

    Les

    Mark Roberge wrote:Hi
    I am very new to Java. I am trying to find an ide to write java code without a lot of figuring out how to  get the ide to work. I have tried IntelliJ. I got one program to work. I am reading Learning Java and java in a nutshell. When I tried to write a modified code I could not. I have also tried BlueJ. Couldn't even write code. I tried getting netbeans. Could not find a download. I went to netbeans site. Right now I am about to try greenfoot.  I think there were a few others but I don't remember.

    Mark

     
    Tim Holloway
    Saloon Keeper
    Posts: 25816
    184
    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 think you may be off on dates a bit. I was using Borland's VisualCafé (R.I.P.) back then. If NetBeans existed that far back, it was still named Forte and owned by Sun Microsytems.
    reply
      Bookmark Topic Watch Topic
    • New Topic