Hello, as i know java source code is visible to ppl, i talk about Desktop Applets,
i'm interested to start learn Java/Web Developing, that i want to know is,
Can ppl see code of java applet in brwoser? like he can with Java Desktop Appis.

Recommended Answers

All 8 Replies

The source code for any Java program (desktop or applet) is visible only if the author chooses to make it visible.

Desktop are *.jar files right?
you can open *.jar file even with rar, you extract files *.class and you can see everything,
This is just 1 tool can do it
http://members.fortunecity.com/neshkov/dj.html

About applets, i cant image how can see code because you dont have access in *.class...

The .class file contains the compiled code, not the source. You can decompile that, but the result may or may not resemble the actual source. If the author has decided to obfuscate the code a decompile is useless.

... but if decompiled .class files are all you want, there's nothing to stop you downloading the .class (or .jar) files for the applet and decompiling them. You have access to the HTML that invokes the applet, so you know where to find the class files

The .class file contains the compiled code, not the source.

i confused little,
(NOT JAVA): Compiler takes source code and convert it to binary-machine code (*.obj), but if *.class are compiled files on java, how these are opened to public... :-s

With few words, i cant have secret parts in java
Can i create an Java applet like this? or they can see it...

if (pass == "admin")
     {
       Application.Run(new MainForm());
     }

native executables can also be decompiled :)

.class file are binary machine code for a artificial machine called the Java Virtual Machine. Software to create a JVM is part of the Java runtime that you must install before you can run a Java program.
Just like with an a .exe, you can use a decompiler program to read the machine code and produce a "best guess" of what the source program might look like. Sometimes it's quite accurate, other times it looks like garbage.
If someone really wants to keep their code secret they use a process called "obfuscation", where the code is jumbled up and names are changed in such a way that it still produces the same result when you run it, but decompilation shows a confusing mess.

the only way to ever keep your source secret (there are deobfuscators, and a human could do it as well given time) is to never distribute anything except data.
That means running your system as a SAAS application, and only exposing some web services for your customers to call.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.