• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Command prompt is giving error but Eclipse is not giving error

 
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Do you know why I see this issue as stated in the comments ?
 
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error? Which line of code?
 
Harikrishna Gorrepati
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tom, Here is the error from command prompt

C:\harikrishna>javac P247_AutoBox01_Ask.java
P247_AutoBox01_Ask.java:7: incompatible types
found : short
required: java.lang.Integer
Integer I7 = (short) 7;
^
P247_AutoBox01_Ask.java:8: incompatible types
found : byte
required: java.lang.Integer
I7 = (byte) 1;
^
2 errors



Tom Reilly wrote:What error? Which line of code?

 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version of Java are you running in Eclipse? Which version are you running from the command line? I believe auto boxing was added in Java 5.
 
Harikrishna Gorrepati
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which version are you running from the command line? --> JDK 1.6/JRE6
Which version of Java are you running in Eclipse?-- > 1.5
Yes. Autoboxing is added in Java 1.5
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to double check, what do you get when you type the following command on the prompt ?

java - version
 
Harikrishna Gorrepati
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:Just to double check, what do you get when you type the following command on the prompt ?

java - version

Hi Deepak, I gave the screenshot
error.jpg
[Thumbnail for error.jpg]
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yet another reason why we always say NOT to use an IDE to study for the SCJP
 
Harikrishna Gorrepati
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following code gives Runtime error (Console Object is not available.) in Eclipse IDE. But works from command prompt. It is a problem in real time projects if these kind of issues exists in IDE. Any idea on how to fix ?

Bert Bates wrote:yet another reason why we always say NOT to use an IDE to study for the SCJP

 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Console doesn't work in Eclipse (System.console() returns null). This is also true for many other IDEs. I forget the reason. You can find discussions in many places.
 
Ranch Hand
Posts: 430
Android VI Editor Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.eclipsezone.com/eclipse/forums/t93685.rhtml
reply
    Bookmark Topic Watch Topic
  • New Topic