I was looking for tool on Java that does the same (similar) functionality of "inspect element" of "Google Chrome". Does anyone has information whether this is available and how it can be implemented?
The question refers to cases when you have the Source code and you don't know the inside of it. Thus, the idea is to inspect elements (objects) on UI while running code!
Since you have access to the code you can use the Java Object Inspector.
Just add one line of code at the right place:
Inspector.inspect(objectToInspect);
Inspect Element in Chrome/Firefox and View Source in Safari are there because the internet is open sourced. The HTML code pushed to a user's machine is viewable by them (obviously not the spreadsheets or other static files held on a server.)
Compiled projects don't have this feature for practical reasons.
In many languages it is impossible to "decompile" an object into its source.
If you could go to Microsoft Word and Inspect any element, you could just copy and paste their application without paying.
So no, you cannot take a compiled Java object and click to see its source code.
I remember hearing about a project that did something like that a few years ago. I can't recall the name, but I ran across this while searching for it. https://github.com/cozycode/Swing-Inspector Based on the description, at least. it looks like it might be useful. If I remember what the original project was i'll post a follow up.
for you to find the java code, in the inspect element go to Sources. Look in the picture below. I inspected google and went to Sources this what i found. press on the files. that say js, and the java code will appear.
if you cant see the pic, tell me. or try to download it, and open it on paint.
enter image description here
Related
Hello everyone here is my problem.
I want to extract 2 words from a website, the words are "won" or "loss". If i can find those 2 words on the website i will be able to write the program i am working on.The problems i have are...
When i write a java program to get the html code from the site it only gives me the html code that is not changing ie: it doesnt giving the dynamic php code parts.
When i "inspect elements" on the website it gives me exactly what i want. It says i either won or loss in the html tags . However if i simply view source it doesn't show me that dynamic php code that u would see when inspecting elements.
Is there a way for me to write code that looks at "inspect elements" for the website and keep track of the part of the html code that is changing between "win" or "loss"?
I've had trouble with something like this before and since you lack details I will give you the best answer I can...
More information that will be helpful to know maybe if you edit include,
Code... Show me what you got
The html code
APIs or frameworks used in you application
So the issue seems like when you request the site the information is not there. Normally this doesn't happen since most webpage display information at load time.
These days we do a lot of stuff with Javascript so therefore that is probably the part you are having problems with. Javascript can load information onto the page dynamically at anytime. It need not me at load time and even if it looks like it by eye that its there when the page loads it may not be since it's too fast to notice.
Look into the javascript code and see if you can find a get, post, or put action and see if you can follow that to where it loads the page. Then mimic the request in your program.
I have written comments in English in my Java files but now my client wants it in Spanish, So is there any tool/Plugin available in RAD or ECLIPSE IDE to convert all the comments in other language. I am using google translator to convert comments manually.
I'm not aware of any plugin like that. First, I would make sure the client really really wants this. Doing an automatic translate of highly technical text will not give a very good quality. I question if they will be usable at all, do a test translate of a couple of comments first to get approval.
If they really want something that is usable someone with language and technical skill would have to manually translate everything, which would take time/money.
But, if I had to do it, I would take the idea from this answer to automatically launch a web browser from Eclipse, and use the URL to google translate, https://translate.google.se/#en/es/${selected_text}, should work.
If the codebase is large and the comments can be easily found, such as a javadoc, I would write some script to automatically handle this. Google translate has an API you can use. See REST API doc
Every now and then a developer has to work on a code base that is in a language that is unknown to him. In this case, he would need to copy variable, class, method names to Google Translate to see what they actually mean.
The Source Code Translation in Eclipse tries to help such developers, by providing a popup with the translated words, when hovering the mouse over them. The plugin is able to handle compound words or phrases that use camelCase or underscore "_" as separation methods.
For the plugin to work, a properties file containing the word to be translated, and the translation needs to be created and added from the Preferences section of the plugin.
Add this URL to your Eclipse Installation to reach this solution's update site.
https://github.com/Testehan/TranslationPluginInstall/raw/master
In External Tools Configurations
Location : ${system_path:cmd.exe}
Arguments : /C start "" "https://translate.google.com/#en/fr/${selected_text}"
I'm very new to Java and JSP.
I am working with a purchased Java web application. When I access the application in my browser, there is a file "mysite.com/app/servlet/com.sample.weblet.server.ClientReader?..." that contains a line of Javascript is erroring out in some browsers. I would like to find the source of that Javascript code so that I can modify it so it will be cross-browser compatible.
I've searched all of the JSP and JS files (which are all in a separate folder, and not packaged into JAR files), but could not find the faulty function.
I dug through the JAR files extensively. I only found class declarations, variable declarations, and empty methods. I have not been able to find any logic whatsoever, and definitely have not come across anything resembling javascript auto-generation. There are no WAR files.
I found com.sample.weblet.server.ClientReader in a jar file.. and it just contained a couple of empty methods, yet again.
I am assuming that this faulty JS code is auto-generated. Does that sound correct?
Is there like one main JAR file that has all of the logic? Would it have this JS code hard-coded into it? What am I missing?
Can anyone direct me, or give me any tips?
My suggestion is you should use firebug to detect the javascript error. If any error occurs, you'll see it under "console" tab in firebug and usually there's a link beside it, click on the link will bring you where the bad code resides.
Also, you can navigate javascript files the page has loaded by clicking the list button under "Script" tab in firebug.
Hope it helps.
I must admit the fact Forms layout does save loads of time, wrt other Swing layouts. I did try out other examples from http://www.java2s.com/Open-Source/Java-Document/Swing-Library/jgoodies-forms/Catalogjgoodies-forms.htm and worked fine. However, i was more interested in the forms-demo code from the actual developer, is it available ? Couldn't find them, other than the executable jar file.
Did you see the com.jgoodies.forms.tutorial.building link in that page? Seems to link to a number of source code listings.
But see also the Java version of the Forms Demo at JGoodies|Downloads|Applications.
The site seems to have been reorganized since my last visit, but you can probably find those things from http://www.jgoodies.com/downloads/
Can someone explain how does this website accesses the contents of the clipboard and displays it?
http://snag.gy
I am working on a similar project and need to make use of this functionality where users can ctrl+v paste an image. Also, if the site is using Java plug-in, why doesn't my chrome pop up out-of-date warning?
Any help is appreciated!
Thank you.
You should be able to tell that by looking at the source (http://snag.gy/assets/js/index.min.js). The code will be unreadable since it's minified, but you can make it readable with a code beautifier (such as http://jsbeautifier.org/).
It uses a java applet to read your clipboard (it's adding it to the page dynamically). It also contains a reference to http://code.google.com/p/zeroclipboard/ which is a flash-based solution mentioned here . I saw that it also makes use of the clipboardData object.
Looks like there are several fallbacks depending on the browser, and also it uses different mechanisms based on the origin of the copied data. You could start with How does the paste image from clipboard functionality work in Gmail and Google Chrome 12+? and fallback to a java applet if the browser is older.