This makes alot of sense! I'll incorporate the fix as soon as possible. Thanks!
Sean
Quoting Binil Thomas <
binil.thomas.public@...>:
>
> Hi Sean,
>
> Thanks, that clarifies it. I dug around the code a bit, and I have a
> hunch
> on the cause of this bug.
>
> Please see the file AbstractLaunchShortcut.java revision 10881 [1]. It
> uses
> ScalaFileUtil.getQualifiedScalaName(file) to convert a IResource to a
> String. Please see revision 10881 of ScalaFileUtil.java [2]. In
> particular,
> notice the method getQualifiedScalaName defined as:
>
> public final static String getQualifiedScalaName(IResource file) {
> IJavaProject jproj = JavaCore.create(file.getProject());
> String path =
> file.getProjectRelativePath().toString().replace(
> ".scala", "");
>
> try {
> for (IClasspathEntry entry : jproj.getRawClasspath()) {
> if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE)
> {
> String srcpath =
> entry.getPath().toFile().getName()
> + File.separator;
>
> if (path.startsWith(srcpath)) {
> path = path.substring(srcpath.length());
> break;
> }
> }
> }
> } catch (JavaModelException e) {
> // ...
> }
>
> path = path.replace('/', '.');
> return path;
> }
>
> If the file path starts with the name of a source folder, the code tries
> to
> remove that prefix. But the file path contains /s, but the code checks
> for
> src_folder_name + File.seperator - which won't match on Windows.
>
> I don't have the PDE setup to change the code and make a patch. But I
> tried
> to reproduce the bug on my Mac and I couldn't. Kindly verify if this
> hypothesis. BTW, if I am right, your initial assertion of "not
> reproducible"
> is correct if you are using a Unix. :)
>
> Thanks,
> Binil
>
> PS: This bug occurs even if you manually create a run profile, search
> for an
> application object and pick it.
>
> [1] AbstractLaunchShortcut.java/10881
>
http://scalasvn.epfl.ch/cgi-bin/viewvc.cgi/plugin/ch.epfl.lamp.sdt.ui/src/ch/epfl/lamp/sdt/ui/launcher/AbstractLaunchShortcut.java?view=markup&rev=10881
>
> [2] ScalaFileUtil.java/10881
>
http://scalasvn.epfl.ch/cgi-bin/viewvc.cgi/plugin/ch.epfl.lamp.sdt.ui/src/ch/epfl/lamp/sdt/ui/launcher/ScalaFileUtil.java?view=markup&rev=10881
>
>
>
>
> sean mcdirmid wrote:
> >
> > Hi Binil,
> >
> > I think the "Run as Scala application" was a contribution (by Itay I
> > think?), so I'm not quite sure how it is
> > broken. I was unclear about your error diagnosis before, it sounded
> like
> > build automatically wasn't
> > checked, but now I understand whats going on.
> >
> > If you want to run something as a Scala application, right now you
> can
> > either manually create the run
> > profile, or you can use the "Scala Application" wizard to create an
> object
> > with a main method in it. I
> > prefer the Scala Application wizard approach, although it doesn't work
> for
> > objects that already exist. I'm
> > sure I can hack this to work right, although I get the feeling "Run
> as
> > Scala Application" wasn't meant to
> > be used in a project setting?
> >
> > Sean
> >
> > Quoting Binil Thomas <
binil.thomas.public@...>:
> >
> >>
> >> Hi all,
> >>
> >> Tonight I tried giving Scala a spin. The initial "getting started"
> >> experience was less than pleasant.
> >>
> >> I installed the Scala Eclipse plugin, created a "hello" project,
> >> switched to
> >> Scala perspective, created a "test" package, and created an object
> >> HelloWorld in it. When I tried to run this code by right-clicking
> the
> >> file
> >> by choosing "Run As -> Scala Application", the code throws up the
> >> error:
> >> java.lang.NoClassDefFoundError: src/test/HelloWorld
> >> Exception in thread "main"
> >>
> >> I searched the web for some help, but eventually got to a bug
> reported
> >> by an
> >> outside contributor.
> >>
> >>
>
http://scala-webapps.epfl.ch/bugtracking/bugs/displayItem.do?id=1108> >>
>
http://scala-webapps.epfl.ch/bugtracking/contribs/display.do?id=471> >>
> >> The bug is marked as "not reproducible" but yet I was reproducing
> >> exactly
> >> the described behavior :(
> >>
> >> After a bit of digging around, I figured out what is wrong - when
> one
> >> right
> >> clicks as chooses "Run as -> Scala application", the run
> configuration
> >> created is incorrect. The Scala Application Object is set to be
> >> src.test.HelloWorld; changing it to test.HelloWorld makes the code
> run
> >> fine.
> >>
> >> Please fix this bug. I am posting this here because I could not
> comment
> >> on
> >> the bug tracking system.
> >>
> >> Thanks,
> >> Binil
> >> --
> >> View this message in context:
> >>
http://www.nabble.com/Scala-Eclipse-Plugin%3A-Please-fix-Bug--1108-> > tf3824702.html#a10827715
> >> Sent from the Scala mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
>
http://www.nabble.com/Scala-Eclipse-Plugin%3A-Please-fix-Bug--1108-tf3824702.html#a10840234
> Sent from the Scala mailing list archive at Nabble.com.
>
>