i am unable find the class file in the jar - java

Below is the code in eclipse,
public class MBILogin extends
com.sterlingcommerce.woodstock.ui.servlet.MBILogin
These are two different MBILogin from two different packages.
I am unable to find the second MBILogin class in the jar file. I have used a decompiler for illustration.
When I hover over it with my cursor, it shows an error error to the effect of "create MBILogin class in such and such a package" or "fix the project," but I'm able to build the project successfully and the application works as expected.
I am unable to discover where the MBILogin class (in that com.sterlingcommerce.woodstock.ui.servlet package) is coming from.
Please give any suggestions to find that class file.

Eclipse provides an easy way to track the project/library where a class is located on:
On a source code window, simply hover the name of the searched class while pressing CTRL. Then click on it, and let Eclipse open it on a new window (no matter if it shows just bytecode and no source code).
Then, you must click on the Link with editor button of the project explorer view: This will show the library/project where the class in active editor window is located.

Related

Error : Could not find or load main class

I've tried to create Main class in my package ("testing").
It was created in same package where i've created my object class. (i.e. Car)
but when running the Main class (Test3), i'm getting the following error.
pls see screen shot.
screen shot
When it happens to me I'm checking two things, try one or both:
go to .classpath file and open it with notepad check verify that all paths are exist.
right click on your project--> "Build path"-->"Configure build path" -->"Orders and Export", try to uncheck "JRE System Library".
Let me know if it works for you.

Visual Studio Java debugger only supports starting the execution in a named class

I am having problems setting up Java Compiler for Visual Studio and keep getting this error. I am using Visual Studio 2015 and the latest version of JDK. I downloaded the Java extension from here.
What could be the cause, how do I solve this problem?
Thank you for your time.
This is the answer that nerdyguy64 said in a forum , This ONE work for ME .....
".. I had this same problem but I figured it out.
Do what it says, go into the Debug tab and then go down and click "'PROJECT_NAME_HERE' Properties"
Then click the "Debug" tab on the side and then you will see "Start Class within project:" radio button. Make sure it is clicked and then in the text field along side it type in the class name that has you main method in it.
Remember, if your main method is within a package you must type the package name then forward slash ("/") and then your class name (with the main method).
For example: if you start a new console application, you should get a basic hello world console application. Since the basic console hello world application has the main method class in a package (called "pkg"), you have to put in the "Start Class within project" field: "pkg/Program"
It's simple. If your main method is in Class1.java file.
You go to properties of your project, go to debug tab, and set "Start class within project" as "YourProjectName/Class1". (Your project name is where the Class1.java is located.)
In vs2015, like hbrtxito says, just set 'pkg/Program' in PropertiesDebug->Start action -> Start class within project

netbeans build project error

i am new in java and i am a student, I am using net beans 8.0 for java developing i created a project and run it using Shift+F6, it is working fine, but when i go for build project from the project categories then in the "Browse Java FX Application Classes" window nothing display in "available classes" so therefore i can't build my project. Moreover the dist folder also not exist in my project.
Please let me know how to resolve this problem where i am wrong or which option i miss.
Thanks in advance.
It needs to find the class that extends Application. You can right click the project in the project window the choose properties then run. You will see a box for Application class. You should be able to select the class there.
If there's nothing in the 'select classes' box then maybe you forgot to declare the class like
public class JavaFXApp extends Application {
//etc..

Eclipse interface link to open related files

This is not a code-related, but a pure IDE work efficiency question.
Is there any Eclipse plugin or built-in feature to provide "links" (shortcuts) to open other relevant .java files in the current project (or any files for that matter) from within a file.
To be more specific, here is an example of what I want to do:
I added new functionality to a class called MyClass in my project.
I also have a unit test file for that class called MyClassTest within another "test" project under a parent project.
Now I want to jump to MyClassTest.java and add new unit tests.
I'm lazy so I don't want to browse with the mouse in the Project Explorer (too many packages) and don't want to press Ctrl+Shift+T and type the class name.
I want some sort of shortcut planted in MyClass.java (or even a side panel window) which when clicked, opens MyClassTest.java for me.
This can be useful for the programmer to "link" related files (.xml, .java, .jsp) so he/she can open them quicker.
The MoreUnit plugin solves exactly this problem for unit tests. You press Ctrl-J while in a class to jump to its test class (and vice versa).
It even simplifies the process of creating the test class in the first place, with naming conventions and method stubs.
Typically in your described scenario I will right click on the "MyClass" (the text name in source) and go "References -> Workspace". This will show me all other "related" classes referring to MyClass. I can then double click on any of them to open which have appeared in the bottom search tab.
This also works great on methods to find out who is using the method in a particular class.
You can make the "Open type" dialog work more easily in this case, if you have selected the name of the current class before opening the dialog. Your current class name is then already filled in.
Then hit End or Cursor right in the open type dialog to remove the selection, type T (for Test) and hit Enter to open the test class.

Plugin dependency has package for which I get a "type <type> cannot be resolved" error

I don't know what I did, but what was once working no longer works.
I am calling a function that returns an instance of a particular class, call it MyClass. MyClass depends on another class, MyOtherClass that is defined in a package. This package (call it com.myotherpackage) is contained in a plugin (call it com.myotherplugin) listed in the dependencies section of my plugin manifest. When I call that function, I get the error "The type com.myotherpackage.MyOtherClass cannot be resolved. It is indirectly referenced from required .class file."
What could I have done to cause this error to crop up where previously the error wasn't present and my code ran just fine?
I've searched for solutions. They all seem to focus on non-plugin environments. One such solution had something that I could map to a plugin. It suggested I configure my build path (right click on project -> Build Path -> Configure Build Path). From this dialog, I selected the Libraries tab, clicked the arrow next to Plug-in Dependencies, then clicked the arrow next to com.myotherplugin, then clicked the arrow next to Access rules, and found that there is a checked check box next to the words "Accessible: com/myotherpackage/*". Thus the package appears to be available though I have no information from this view that MyOtherClass is contained in that package.
Any ideas would be appreciated.
You have to export com.myotherpackage in the manifest of com.myotherplugin. You can do so in the Plug-in Manifest Editor on the Runtime page.
Also Eclipse usually provides a Quick Fix for these kind of errors, which make the required changes in the manifest file.
I don't like this answer, but reinstalling the IDE did the trick (i.e., unzipping from source). Note that my instance of the IDE comes with com.myotherplugin.
I have no idea what I broke.

Categories