473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

get the source code

oll3i
679 512MB
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:)
Dec 8 '08 #1
12 1686
JosAH
11,448 Expert 8TB
Like this?

Expand|Select|Wrap|Line Numbers
  1. 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));}}
  2.  
kind regards,

Jos
Dec 8 '08 #2
Nepomuk
3,112 Expert 2GB
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
Dec 8 '08 #3
JosAH
11,448 Expert 8TB
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
Dec 8 '08 #4
Nepomuk
3,112 Expert 2GB
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
Dec 8 '08 #5
JosAH
11,448 Expert 8TB
@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
Dec 8 '08 #6
Nepomuk
3,112 Expert 2GB
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
Dec 8 '08 #7
oll3i
679 512MB
no no i just need to write a simple program that displays its source code
Dec 8 '08 #8
oll3i
679 512MB
but that would mean i have to write a decompiler
Dec 8 '08 #9
oll3i
679 512MB
hmm and how do i strat ? hm hm hm
Dec 8 '08 #10
oll3i
679 512MB
so this program will have to read in .class file and then output the source code
i will have to look for patterns?
Dec 8 '08 #11
Nepomuk
3,112 Expert 2GB
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
Dec 8 '08 #12
JosAH
11,448 Expert 8TB
@oll3i
Programs that display their own source code are called a "quinne"; see my reply #2.

kind regards,

Jos
Dec 9 '08 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

5
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...
9
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...
115
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...
4
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. ...
15
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...
8
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....
7
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...
66
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,...
4
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,...
1
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...
0
isladogs
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...
0
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...
0
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...
0
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...
0
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
0
BarryA
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...
1
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...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.