Debug Java Applet jar file in eclipse - java

I have a compiled jar file which is a compiled applet. I have the parameters and name of the class with the init method to start the applet.
I have installed jd-eclipse and would like to debug the applet in eclipse?

It should be pretty straightforward to do. Assuming at least Eclipse Galileo:
Create a project in Eclipse and add your applet jar(s) to its build
path. Alternatively you may choose to add the applet jar(s) to the
build path of an existing project.
Right-click your project, select Run As->Run Configurations Select
Java Applet in the left hand pane and click the New button at the top
of the pane
At the top, fill out a name for the new Run configuration, then on the
Main tab click to Search for your applet class.
On the Parameters tab, fill out all parameters from your existing
Applet HTML page.
Optionally, fill out any additional information you want the Applet
to have when it runs, on the other configuration tabs
When done, click Apply, then optionally Run to fire off the test
right away.
Good luck!

Related

Proper way to configure IntelliJ to use source code for decompiled jar

I have been trying to figure this one out for a bit, not coming up with the right approach. I read through this question, which I'd already tried, but it's not working quite right.. using IntelliJ EAP 142.4675.3
What I am trying to do, is to debug a junit test using a jar (extending the Provider class) file I've placed into JAVA_HOME\jre\lib\ext. I want that jar to be debuggable as well.
The problem is, if I attach my source directory as the source for a jar, then, in a stack trace, when I click the named file (containing a method I wish to view), IntelliJ asks me to choose between two of the same file, presumably because it knows about the source (it's in a module in my project) and it's also been told about the source via the jar source path I added.
I tried adding the provider.jar to the project module dependencies tab, which caused intellij no end of grief. Reverted back to having it in jre\lib\ext, and, in the Platform Settings->SDKs->1.8->Sourcepath tab, I added the module sourcepath. This lets intellij step into the .java file for the jar, vs the .class file, but, when it does so, I now get a banner at the top of my code windows which says "Alternative source available for the class xxx" and there's a combobox at the RHS with the module name listed twice (in the latest EAP, it actually lists the module and the jar [same name as module, with .jar]). And, as mentioned earlier, the IDE asks which which (of the very same) file I wish to edit when I click a file in the stack trace.
Clearly, there is something not quite right.. what am I missing? I find it odd that the ide will not open the source code when stepping into the jar until I attach the code as above, but, when I do, it sees it twice.
So let's start from scratch:
File > New Project, choose "Java Module", fill the form:
Bypass the form asking about the kind of project (webapp etc) by clicking on "finish"
you now have a project with a src dir:
right click the 32910506 directory and choose "New" then "Directory" and create a new directory named lib.
drag and drop your 2 jars (sources and code) to this directory (I will use common-lang for this example), beware to copy, not move:
now right click on src, choose "New", "Java class", name it App:
right click your "code jar" and choose "Add as library":
in App type psvm then hit TAB to get a main and fill it like this:
right click on your "code jar" and choose "Open library settings":
click "+" and choose "Attach file or directory" and select your "sources jar":
Now if your Ctrl+click on random in App, you should end up to the method source:
Put a break point in the random method:
Now right click App, choose "Debug App.main()", you should end up to the previous breakpoint:
Used: idea 12.1.6 under linux

splashscreeen not working in netbeans IDE for java?

slash screen tutorial
By following the above tutorial i did the following things
step1: created a new project named SplashScreenTest
step2: include the gif file named laoding.gif in the project
step3: added a new JFrameForm to project with the name StartGUI.java
step4: rightclick the form->properties->code->form size
policy->generate resize code
generate position ->untick
generate size ->untick
generate center ->tick
step5: replaces "Nimbus" with "Windows" inside
step6: right click SplashScreenTest->properties->VMoptions
-splash:src/AppPackage/loading.gif
step7 : open Manifest.mf write "SplashScreen-Image:
AppPackage/loading.gif"
step8: set main class to AppPackage.StartGUI
Now as soon as i hit the clean and build button it returns an error
"existing manifest file is invalid"
May I know what is the correct way to achieve my objective?Maybe this question too basic, but i did't find any suitable solution.Please Help me out.
I'm kind of weirded out by the hoops you are jumping through, Netbeans actually provides support for the splash-screen via the Project's Properties
Right click the project node...
Select the "Application" properties...
Browse for the splash screen image to be used...Netbeans will automatically included within the compiled jar file...
Clean and build your project...

how to open specific Jframe as a main jframe?

when I run the project compiler says BUILD SUCCESSFUL but not any window is appear. when I runt the project I want to start main_window as a default window. but I have no Idea how to setting up this.
If you are creating a jar file (as I assume you will be doing from your previously deleted question), the main class would be specified by the jar file's manifest.
e.g., the manifest file, named MANIFEST.MF could contain a line looking like:
Main-Class: gui.main_window
Right Click on the Netbeans tool-bar. An drop down menu should appear. Select Customize and scroll down through the options until you see Run File. Drag the button onto the tool-bar. Now select the main_window.java and hit the Run File button.
The IDE should run only the file.

How to change default java logo exe icon on the taskbar in javafx?

I made a JavaFX application on Netbeans and I put this code for setting the icon to the window
primaryStage.getIcons().add(new Image("file:sicadcam.png"));
and when I run the project from Netbeans, it works ok: the icon appears on the window and in the taskbar. where I have to put the image.
When I clean and build the project, it generates two installers: one exe and one msi; and when I install the application and open it, the window doesn't have the icon sicadcam.png, it has the default java logo icon.
How or where can I set the path of the image so that when I install the application the icon appears.
You should place the icon in your jar or classpath and then load it through a resource function.
E.g. if you place it to your bin folder, into the package where your class is, then the following should work:
primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("sicadcam.png")));
I suspect that the image is not handled as a resource and not getting into your Jar file. Can you verify if it is there? (You can do that by Total Commander for example by pressing Ctrl+PgDown to go into the archive).
Another reason might be that NetBeans using a different run configuration and classpath. Where is your image? If it is in the package root (i.e., the folder which contains your top-level package), you can probably access it somehow like: ImageIO.read(getClass().getResourceAsStream("/sicadcam.png")).
Hope that helps something.

how to open jar selection dialog at the eclipse pulgin code

At Project > Properties > Java Build Path > Libraries tab
you click Add Jars button, you will see the JAR Selection dialog.
I like to open this JAR Selection dialog on my plugin code.
How to open this?
With the Eclipse RCP edition (which you must have since you are developing a plugin), you can use the Plugin Spy (Alt+Shift+F1) and see what exact class you need:
alt text http://img541.imageshack.us/img541/2232/eclipsetreesel.png
It is based on org.eclipse.jdt.internal.ui.viewsupport.FilteredElementTreeSelectionDialog (strangely absent from the sources of org.eclipse.jdt.internal.ui.viewsupport), derived from org.eclipse.ui.dialogs.ElementTreeSelectionDialog.
If you want to see how it is opened, you need to have a look to the global window opening that dialog:
alt text http://img41.imageshack.us/img41/1903/eclipselibclass.png
It is the org.eclipse.jdt.internal.ui.preferences.BuildPathsPropertyPage, from which you can infer the various action classes associated with the button and see how it works.

Categories