is there a function or a way to get the source code of the program and display it?
i need to display the source code of java program simple hello world would be enough:)
12 1686
Like this? -
class S{public static void main(String[]a){String s="class S{public static void main(String[]a){String s=;char c=34;System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}";char c=34;System.out.println(s.substring(0,52)+c+s+c+s.substring(52));}}
-
kind regards,
Jos
Basically, if you have the .java file, just open it with an editor (e.g. notepad). If you don't, you can decode it from a .class file with specific programs. (The legality of this may vary, depending on the licence and country you are in.) And if you have a .jar file, you can unpack that first - a jar file is just a zip file with a different extension and a MANIFEST file.
Greetings,
Nepomuk
Two nitpicks:
1) a jar file doesn't always need a MANIFEST file;
2) what to do if there's no .java source file around?
kind regards,
Jos
OK, there doesn't have to be a Manifest file. But I answered that "what if there's no .java file" question already. Second sentence... ^^
Greetings,
Nepomuk
@Nepomuk
Have you ever seen the result of a Java decompiler? They're all crap from what I have seen. It doesn't even compile anymore.
kind regards,
Jos
Actually, I have and for simple programs at least, the output can be quite good. Don't know which decompilers you used of course.
Greetings,
Nepomuk
no no i just need to write a simple program that displays its source code
but that would mean i have to write a decompiler
hmm and how do i strat ? hm hm hm
so this program will have to read in .class file and then output the source code
i will have to look for patterns?
You don't have to write one yourself, no. I've used DJ Decompiler in the past and was quite pleased with it. However as I said, make sure the licence of whatever you're decompiling actually allows to do so.
Greetings,
Nepomuk
@oll3i
Programs that display their own source code are called a "quinne"; see my reply #2.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Tim Zhao |
last post by:
I downloaded the PHP 5 source code from
www.php.net web site. It is a tar compressed
file. I used WinZip to unzip it. Now I got a whole
bunch of files.
But I do not know to read these files. Do...
|
by: FISH |
last post by:
Ever have one of those days when you're not sure if it's you who's gone
mad, or the rest of the world?
I have an Open Source project on SourceForge for communication with YSMG
- Yahoo's IM...
|
by: TheAd |
last post by:
At this moment I use MsAccess and i can build about every databound
application i want. Who knows about a serious open source alternative?
Because Windows will be a client platform for some time, i...
|
by: kj |
last post by:
I consider myself quite proficient in C and a few other programming
languages, but I have never succeeded in understanding a largish
program (such as zsh or ncurses) at the source level. ...
|
by: Fady Anwar |
last post by:
Hi while browsing the net i noticed that there is sites publishing some
software that claim that it can decompile .net applications i didn't bleave
it in fact but after trying it i was surprised...
|
by: Alvo von Cossel I |
last post by:
hey everybody,
I have written a great browser but it is missing a feature (quite a lot
actually, but forget about them for now). that feature just so happens to be
the View > Source function....
|
by: Tina |
last post by:
In 1.1 I used to use a WebControlLibrary to hold code I didn't want to
expose when I distributed a component. The code would compile to a separate
dll and could not be viewed when used in a vs.net...
|
by: Jon Skeet [C# MVP] |
last post by:
I'm sure the net will be buzzing with this news fairly soon, but just
in case anyone hasn't seen it yet:
Microsoft are going to make the source code for the .NET framework
(parts of it,...
|
by: Spizzat2 |
last post by:
I'm trying to figure out a workaround to a minor annoyance that I'm
coming up with while coding a site. I've got some keyboard shortcuts
set up for the site via javascript, and when I press escape,...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |