facebook

Problem with F3 to zoom into a class in a JAR library.

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #314234 Reply

    Hello,

    I have been fighting with this one for ages. Sometimes it works, sometimes not. I haven’t been able to find out why. I have a project A that is deployed as a JAR and a project B that uses the JAR. I cannot properly zoom (F3) into the library source.

    I will post this as a bug report. Maybe I am doing something wrong, in that case, I hope someone can tell me what. In short, the problem is that when I use F3 to open a class in my library or if I click on a stack trace, it open the .java source but the tab says “.class” and is read-only.

    Any help is appreciated.

    ——————————
    Steps to reproduce the problem:

    – download and install MyEclipse 9.0 M2
    – open MyEclipse in a new workspace

    – create a new Java project AlphaProject
    – create a new Java class (root package)

    public class Alpha {
    public static void main(String[] args) {
    System.out.println(“Hello, World!”);
    throw new RuntimeException(“oops!”);
    }
    }

    – export to a JAR file:
    . – click File > Export…
    . – select Java > JAR File
    . – click Next>
    . – check AlphaProject
    . – select “C:\AlphaLib.jar” as destination (or in any other place)
    . – click Finish

    – create a new Java project BetaProject
    – in project properties, Java Build Path, Libraries
    . – add external JAR “C:\AlphaLib.jar”
    . – set its source attachment to “/AlphaProject/src”
    . – OK

    – In BetaProject, create a new class

    public class Beta {
    public static void main(String[] args) {
    Alpha.main(args);
    }
    }

    – Move your cursor to “main” in “Alpha.main(args)” and press F3

    => The file opens under a tab “Alpha.class” and not “Alpha.java”. It is readonly.

    – close all files
    – run Beta.java. It causes an exception

    Exception in thread “main” java.lang.RuntimeException: oops!
    at Alpha.main(Alpha.java:5)
    at Beta.main(Beta.java:4)
    Hello, World!

    – click on (Alpha.java:5) to zoom into the source

    => Again, the file opens under a tab “Alpha.class” and not “Alpha.java”. It is readonly.

    ——————————
    What I get:
    In both cases, MyEclipse opens a tab labeled “Alpha.class” that displays Alpha.java in read-only.

    What I expect:
    I expected to open Alpha.java in the project specified in the source attachment and be able to modify it.

    #314281 Reply

    support-joy
    Member

    florianfj,

    This is not an issue. If you use F3 to open a class in a library, it opens .class file only and you cannot edit a file which is in a jar file in MyEclipse.

    Please follow below step if you wish to edit this file –
    1. Create Alpha project with a java class in the root package
    2. Now create Beta Project and Goto Buildpath > configure BuildPath > Projects Tab > Add > Select Alpha project and click Finish
    3. Now create a class within root package and add the source code
    4. Now when You press (F3), it takes you to .java file where you can edit the .java file.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Problem with F3 to zoom into a class in a JAR library.

You must be logged in to post in the forum log in