• 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

I saw a tutorial, Eclipse offers him more imports than me, why?

 
Ranch Hand
Posts: 109
  • Number of slices to send:
    Optional 'thank-you' note:
Hello, good day, I was imitating the tutorial and I found that this happens with the Date type class. How can I solve this problem? Eclipse has been failing me for months, thanks.
I can't update eclipse either, by clicking on that option. Why? Thank you.
MI-ECLIPSE-POCAS-OPCIONES.png
Mine Eclipse
POCAS-OPCIONES-ECLIPSE.png
His eclipse
 
Marshal
Posts: 4525
572
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:
I'm not sure how it is not working for you.

When I create a class similar to yours, and hover the cursor over the Date type in the constructor, I am presented with a list of fixes, which includes adding an import for various types.




When I (left) click the java.util.Date option, an import for that type gets added to the class file.




Is this not the same for you?


I am using Eclipse IDE for Enterprise Java and Web Developers version 2023-12 (4.30.0)
 
Saloon Keeper
Posts: 27851
196
  • Number of slices to send:
    Optional 'thank-you' note:
I'm not sure I understand the question.

When you click the "error" icon at the left bar and get presented with the popup list of fixes, the possible fixes suggested are built based on Eclipse' view of your development environment. Your environment isn't necessarily going to be the same as someone else's, since it's made from detectable resources in your system, and that can include stuff like Maven repositories, other workspace projects, environment settings, JDK selected and so forth.

With luck, you'll see the solution you need in that list, and all you need to is select it from the menu. Eclipse will then attempt to resolve the error based on your selection.
 
Ron McLeod
Marshal
Posts: 4525
572
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

In the thread title, Bruno Valdeolmillos wrote:I saw a tutorial, Eclipse offers him more imports than me, why?


Oh - I didn't pay attention to the title - you are asking why does the IDE in the tutorial show more import options than yours (or mine).

The import options  presented are based on the classes  with a matching name found in the classpath/modulepath.

To demonstrate, if I create a new class named Date and put it in separate package so that an import is required, you can see that it will now show-up as an import option.



It looks like in the tutorial, the presenter's project includes Date classes from the sun.util.calender.BaseCalendar and sun.util.calender.LocalGregorianCalendar packages, so they show up in their list of import options.
 
Bruno Valdeolmillos
Ranch Hand
Posts: 109
  • Number of slices to send:
    Optional 'thank-you' note:

Ron McLeod wrote:I'm not sure how it is not working for you.

When I create a class similar to yours, and hover the cursor over the Date type in the constructor, I am presented with a list of fixes, which includes adding an import for various types.




When I (left) click the java.util.Date option, an import for that type gets added to the class file.




Is this not the same for you?


I am using Eclipse IDE for Enterprise Java and Web Developers version 2023-12 (4.30.0)


I have the same version as you.
And it offers you and option plus 12 and to me 11.
I wonder if it has something to do with the JDK?
They recommended that I touch something in preferences and now 14 solution options appear
My main question is why there is so much difference between possible solutions to that error, in this case 13.
It makes me think that my jdk, or something is incomplete or poorly configured (because I have had many problems with Eclipse for a long time)
It is not bad practice to create a class with the name Date?thank you
 
Marshal
Posts: 28258
95
  • 1
  • Number of slices to send:
    Optional 'thank-you' note:

Bruno Valdeolmillos wrote:I have the same version as you.

But Ron's point is that your classpath doesn't contain all of the classes named "Date" that his classpath does, or that the tutorial guy's does.

I wonder if it has something to do with the JDK?

No, it's the classpath.

It is not bad practice to create a class with the name Date?thank you

Not especially. I suppose if you have a class which represents a date you might want to consider just using Java's built-in Date class, but you could have reasons not to do that.
 
Bruno Valdeolmillos
Ranch Hand
Posts: 109
  • Number of slices to send:
    Optional 'thank-you' note:

Paul Clapham wrote:

Bruno Valdeolmillos wrote:I have the same version as you.

But Ron's point is that your classpath doesn't contain all of the classes named "Date" that his classpath does, or that the tutorial guy's does.

I wonder if it has something to do with the JDK?

No, it's the classpath.

It is not bad practice to create a class with the name Date?thank you

Not especially. I suppose if you have a class which represents a date you might want to consider just using Java's built-in Date class, but you could have reasons not to do that.


And for what reasons does my classpath not have all the Date classes?
 
Paul Clapham
Marshal
Posts: 28258
95
  • Number of slices to send:
    Optional 'thank-you' note:

Bruno Valdeolmillos wrote:And for what reasons does my classpath not have all the Date classes?


Because you haven't downloaded them from wherever that other guy downloaded them from and put them into your classpath.

Not that you should, of course. The other guy wanted them for some reason unknown to us. If you want them then by all means go and find them. But they aren't part of the JVM so you shouldn't expect to find them in your classpath.
 
reply
    Bookmark Topic Watch Topic
  • New Topic
vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |