Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Help with .substring()
Help with .substring() [message #1090222] Mon, 19 August 2013 22:02 Go to next message
james mathison is currently offline james mathisonFriend
Messages: 5
Registered: August 2013
Junior Member
I've been taking online classes on java and am working on one of the assignments and am trying to use the .substring method. the rest of the program works great but when it gets to the line with the .substing the program stops and it says "source not found" and gives me the option to "edit source path lookup...". Does anyone know what this means or how to fix it? Thanks.
Re: Help with .substring() [message #1090240 is a reply to message #1090222] Mon, 19 August 2013 22:43 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

Assuming you mean java.lang.String#substring(), it literally means that the corresponding source for the method is not found. Usually the easiest thing to do is to have your project built against a JDK (which provides the sources in a spot where Eclipse knows to look) rather than a JRE, or to edit the source lookup path and add the matching src.zip to the list of places to look. Eclipse itself may only require a JRE to run itself, and to compile your Java programs, but there are benefits to having a JDK installed when you're actually developing Java with Eclipse.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Help with .substring() [message #1090774 is a reply to message #1090240] Tue, 20 August 2013 16:16 Go to previous messageGo to next message
james mathison is currently offline james mathisonFriend
Messages: 5
Registered: August 2013
Junior Member
Thanks for the information. I think I understand what you are saying but how do I build my project against a JDK? I downloaded the JDK from ORACLE and installed it but just doing that doesn't seem to have changed anything. Is there anything else i need to do? Thanks again for the help, im pulling my hair out trying to figure this out..
Re: Help with .substring() [message #1090800 is a reply to message #1090774] Tue, 20 August 2013 16:52 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 8/20/2013 10:16 AM, james mathison wrote:
> Thanks for the information. I think I understand what you are saying
> but how do I build my project against a JDK? I downloaded the JDK from
> ORACLE and installed it but just doing that doesn't seem to have changed
> anything. Is there anything else i need to do? Thanks again for the
> help, im pulling my hair out trying to figure this out..

1. Window -> Preferences -> Java -> Installed JREs -> Add -> Standard VM
-> Next -> Directory....

2. Navigate to the top of your JDK (something like jdk1.7.0_25). click OK.

3. Finish.

4. Ok.

And you're off!
Re: Help with .substring() [message #1090807 is a reply to message #1090800] Tue, 20 August 2013 17:09 Go to previous messageGo to next message
james mathison is currently offline james mathisonFriend
Messages: 5
Registered: August 2013
Junior Member
It doesnt want to allow me to click the JDK file. It is a .dmg file does it need to be something else? Also I am on a mac if that makes a difference.
Re: Help with .substring() [message #1090819 is a reply to message #1090807] Tue, 20 August 2013 17:23 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 8/20/2013 11:09 AM, james mathison wrote:
> It doesnt want to allow me to click the JDK file. It is a .dmg file
> does it need to be something else? Also I am on a mac if that makes a
> difference.

Uh, .dmg, is that a Macintosh thing? Like a package? You must disembowl
it into the file system. Then, it won't be a file, but a subdirectory,
with a name similar to what I said. Should work then.

If not, there are a few Mac guys that haunt this forum. They'll be along
sometime.
Re: Help with .substring() [message #1090825 is a reply to message #1090819] Tue, 20 August 2013 17:40 Go to previous messageGo to next message
james mathison is currently offline james mathisonFriend
Messages: 5
Registered: August 2013
Junior Member
A .dmg I believe is the mac equivalent of a .iso on windows. Does that mean i downloaded the wrong thing?
Re: Help with .substring() [message #1090848 is a reply to message #1090825] Tue, 20 August 2013 18:17 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 8/20/2013 11:40 AM, james mathison wrote:
> A .dmg I believe is the mac equivalent of a .iso on windows. Does that
> mean i downloaded the wrong thing?

I'm not a Macintosh guy. I just played around with installing
jdk1.7.0_25 on a Macintosh (using the .dmg), but once finished, it was
totally unclear to me how to point Eclipse at it.

At this point, I'm going to punt you to the next Mac guy who passes by.

Sorry.
Re: Help with .substring() [message #1091461 is a reply to message #1090848] Wed, 21 August 2013 14:38 Go to previous messageGo to next message
Greg Pugh is currently offline Greg PughFriend
Messages: 15
Registered: July 2009
Junior Member
On 2013-08-20 18:17:55 +0000, Russell Bateman said:

> On 8/20/2013 11:40 AM, james mathison wrote:
>> A .dmg I believe is the mac equivalent of a .iso on windows. Does that
>> mean i downloaded the wrong thing?
>
> I'm not a Macintosh guy. I just played around with installing
> jdk1.7.0_25 on a Macintosh (using the .dmg), but once finished, it was
> totally unclear to me how to point Eclipse at it.
>
> At this point, I'm going to punt you to the next Mac guy who passes by.
>
> Sorry.


You need to install the JDK from the .dmg file you downloaded. Double
click the .dmg file and it should mount the dmg and display a small
window telling you to double click the icon in the window to install
the JDK. Once the install is done you can close the window and Eject
the mounted dmg file.

Recent Java installs for Mac are in /Library/Java/JavaVirtualMachines
rather than the old /System/Library/... location.
Re: Help with .substring() [message #1091466 is a reply to message #1091461] Wed, 21 August 2013 14:43 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 8/21/2013 8:38 AM, Greg Pugh wrote:
> On 2013-08-20 18:17:55 +0000, Russell Bateman said:
>
>> On 8/20/2013 11:40 AM, james mathison wrote:
>>> A .dmg I believe is the mac equivalent of a .iso on windows. Does that
>>> mean i downloaded the wrong thing?
>>
>> I'm not a Macintosh guy. I just played around with installing
>> jdk1.7.0_25 on a Macintosh (using the .dmg), but once finished, it was
>> totally unclear to me how to point Eclipse at it.
>>
>> At this point, I'm going to punt you to the next Mac guy who passes by.
>>
>> Sorry.
>
>
> You need to install the JDK from the .dmg file you downloaded. Double
> click the .dmg file and it should mount the dmg and display a small
> window telling you to double click the icon in the window to install the
> JDK. Once the install is done you can close the window and Eject the
> mounted dmg file.
>
> Recent Java installs for Mac are in /Library/Java/JavaVirtualMachines
> rather than the old /System/Library/... location.

So, when attaching the JDK to Eclipse via Window -> Preferences -> Java
-> Installed JREs, etc., what is the directory name to stop on? In other
words, which subdirectory after JavaVirtualMachines do I feed to the
file-open dialog asking me to "Select the root directory of the JRE
installation"?
Re: Help with .substring() [message #1092581 is a reply to message #1091466] Fri, 23 August 2013 01:06 Go to previous messageGo to next message
james mathison is currently offline james mathisonFriend
Messages: 5
Registered: August 2013
Junior Member
Thats my question as well. I was able to install it pretty easily but I cant figure out how to make eclipse see it either.
Re: Help with .substring() [message #1092597 is a reply to message #1092581] Fri, 23 August 2013 01:42 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

If your Installed JREs preference page has a Search button, use it. Otherwise, you want the parent folder of the "bin" directory that contains the "java" binary.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Help with .substring() [message #1094324 is a reply to message #1090222] Sun, 25 August 2013 14:03 Go to previous message
Greg Pugh is currently offline Greg PughFriend
Messages: 15
Registered: July 2009
Junior Member
For Java 7 update 20 the path is
/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home
Previous Topic:importing project from git
Next Topic:exitcode=2 error
Goto Forum:
  


Current Time: Thu Mar 28 16:49:43 GMT 2024

Powered by FUDForum. Page generated in 0.04062 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top