• 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

Can not find symbol isEmpty location java.lang.String

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any body tell in which jdk this method is added i am using jdk1.6.14 still not able to solve this compile problem
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
api doc says 'since 1.6'
-> http://java.sun.com/javase/6/docs/api/java/lang/String.html#isEmpty()

Are you sure you're using the correct compiler (e.g. type in shell 'java -version')?
 
Marshal
Posts: 79263
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Taucher wrote:Are you sure you're using the correct compiler (e.g. type in shell 'java -version')?

You mean javac -version, surely? Of course, if the java version is wrong, you will still get an error, albeit a different one.
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya its giving as jdk 1.3.1 ,

i have set my path to point 1.6 in system properties how command promt shows as jdk 1.3

My path setting -->as oracle is using 1.3 is it the reason it is showing as 1.3 ??
PATH =
C:\jdk1.6\jre\bin\client;C:\jdk1.6\jre\bin\client;D:\app\ixi\product\11.1.0\db_1\bin;C:\orant920\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\MKSNT\bin;
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's because the java executable is located in the bin folder, not in the bin\client folder.
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya got it but problem is not yet solved but it was referring jdk from oracle


now command prompt is showing it as jdk 1.6.14

still i am getting compilation issue

my PATH =
C:\jdk1.6.0_14\bin;C:\jdk1.6.0_14\jre\bin\client;C:\jdk1.6.0_14\jre\bin\client;D:\app\ixi\product\11.1.0\db_1\bin;C:\orant920\bin;C:\MKSNT\bin;C:\MKSNT\bin\X11;C:\MKSNT\mksnt;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Windows Imaging\;C:\IFOR\WIN\BIN;C:\IFOR\WIN\BIN\EN_US;C:\Program Files\IBM\License Use Management\BIN;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;C:\enoviav6r2011x\server\bin\winnt

 
Rob Spoor
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ravindra patil wrote:still i am getting compilation issue


What's the exact error message?

I don't see why this method was added anyway. It's just shorthand for length() == 0. The only advantage is 4 characters less.
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ha ha ... it got solved .... it was our application file that was pointing to jdk 1.5


thanks guys ...
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:I don't see why this method was added anyway. It's just shorthand for length() == 0. The only advantage is 4 characters less.


Only four characters, but for me it's more about having less cognitive overhead. This seems like a big readability ROI:Less syntactic noise and more expressive; I find isEmpty to be much clearer, and tells a better story when read out loud (my ultimate standard of readability). There's a reason every string utility package has isEmpty() and/or isBlank()...

And both ELs and non-Java JVM languages can call it with foo.empty which is cleaner still--without having to monkeypatch String.
 
Campbell Ritchie
Marshal
Posts: 79263
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote: . . . It's just shorthand for length() == 0. The only advantage is 4 characters less.

Strinjg is a "library class" and you usually put as many methods in a library class as possible, just in case somebody wants to use it.
reply
    Bookmark Topic Watch Topic
  • New Topic