• 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
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Help: I'm Getting an Exception error back in Eclispe when executing the following for Zoo.java file.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

package LearningJava;

public class Zoo {
   public static void main(String[] args) {

       
   }
   
}

$ javac Zoo.java
$ java Zoo
   



Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at LearningJava.Zoo.main(Zoo.java:4)
2018-10-25_0-15-23.png
[Thumbnail for 2018-10-25_0-15-23.png]
 
Saloon Keeper
Posts: 11054
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Missing a closing brace. Note your code text does not match the code in the screen snapshot.
 
Marshal
Posts: 80616
468
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please have a look at this FAQ. You should have a red mark against the line where the IDE thinks you have the error, and it should tell you what the error is if you hover the mouse over the red mark. Then you can have a go at correcting it.
 
Campbell Ritchie
Marshal
Posts: 80616
468
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can see the red marks in the screenshot you posted.
 
Sheriff
Posts: 7126
185
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
These aren't Java statements; they are command line statements.  When you're in Eclipse, you can either

* Press the "run" icon in the toolbar
* Pull down the Run menu and select Run
* Press Ctrl-F11
 
Eva Iris Rivera
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for you responses. just a quick question in the OCA Java SR 8 Programmer I Study Guide on page 6,7 and 8.  

How are we expected to execute the the following and get the expected results?if they display command line statement?



 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Open a command terminal and cd to the source folder.
Though, if they're talking about compiling/executing from the command line then it's probably an idea not to use an IDE for those parts.
 
Campbell Ritchie
Marshal
Posts: 80616
468
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even less, Eclipse. Part of the cert exam preparation is learning what will and what won't compile. The Eclipse compiler can give different error messages from the Oracle and OpenJDK compilers. Although I think that Eclipse's error messages are often better, it might be easier to learn if you get the same error messages as in the book.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic