Conversion of class files to source codes
I was informed that it is possible to convert class files back to the java sourcs codes from where those are generated. How can I protect my source codes from illegal copying by others ?
hai ,
yes it is possible to convert class file into source code. there is a software called jad.exe available in the net
using witch u can convert class file into jar file. but i don't know how to protect the class file to avoid the illigal convertion.
Similar Messages
-
How to calculates averages and send to a file?(source code)
how to calculates averages and send to a file?(source code) I need to get started but I don't know where to begin...........the book I have doesn't really say how to handle averages and send to a file.................anybody got suggestions on how to get started? I am a newbie so place in layman's terms.............thanx
To calculate an average: add all of the numbers together and divide by how many numbers you added together.
ex: (1 + 2 + 3 + 10)/4 = 4 (4 is the average)
As for writing them to a file, look over the API for random or sequential access files. -
Jar file and source code? (new to java!)
Hi all!
Sorry if this is a dumb question but I'm really new to java (.net guy).
Someone sent me a jar file and now I need access to source code. I now that I can rename to .zip and view its contents (.class)...
But what about source code? Can I decompile? As i understand, .class files are compiled .java files...
Should I ask for the source code to the guys that sent me the .jar file?
thanks
jayHumm... is java as fast as replies in this forum? Thank's for your replies warnerja and zadok
I need the source code so that I can understand how the original developer solved a problem. I can ask for the source code.
I posted this message because I was afraid that the question was stupid and source code was in front of me. I am really new to java!
So. No source code in .jar or .class files. Right?
Thanks
Jay -
Running the .class file from java code
I'm doing a kind of providing service like compiling and running Java code on server side and giving output to the end user.
Please suggest me an approach with code to run .class file from the Java code.
import java.io.*;
public class demo {
public static void main(String args[]) throws IOException, InterruptedException {
int result;
try {
System.out.println("command output:");
Process proc = Runtime.getRuntime().exec("java -cp . demoh");
InputStream in = proc.getInputStream();
result = proc.waitFor();
BufferedInputStream buffer = new BufferedInputStream(proc.getInputStream());
BufferedReader commandOutput = new BufferedReader(new InputStreamReader(buffer));
String line = null;
System.out.print(commandOutput);
try {
while ((line = commandOutput.readLine()) != null) {
System.out.print(line);
System.out.println("command output: " + line);
}//end while
commandOutput.close();
} catch (IOException e) {
//log and/or handle it
}//end catc
} catch (IOException e) {
System.err.println("IOException raised: " + e.getMessage());
}What happened when you tried what you have there?
-
Applying a patch file to source code
Hi,
In reference to this post: http://forum.eeeuser.com/viewtopic.php?pid=30515#p30515
Please could someone explain to me how to apply the patch to the source code?
I tried: cat patch_file | patch -p0 where patch_file contained the patch code,
[jack@tmain L2-linux-driver_new]$ cat patch_file | patch -p0
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|Only in l2.fixed: Module.symvers
|diff -u l2/at_ethtool.c l2.fixed/at_ethtool.c
|--- l2/at_ethtool.c 2007-04-20 09:34:48.000000000 +0200
|+++ l2.fixed/at_ethtool.c 2007-11-25 01:58:24.000000000 +0100
My directory structure is as follows:
[jack@tmain L2-linux-driver_new]$ ls -R
COPYING atl2.spec patch_file release_note.txt
atl2.7 ldistrib.txt readme src
./src:
Makefile at_ethtool.c at_hw.h at_osdep.h kcompat.c kcompat_ethtool.c
at.h at_hw.c at_main.c at_param.c kcompat.h
I tried renaming src to l2, but that gave me further errors.
Any ideas?
Thanks alot,
Jack
Last edited by tntcoda (2007-12-25 23:55:43)Thanks, that gave me:
[jack@tmain l2]$ patch -Np1 -i patch_file
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|Only in l2.fixed: Module.symvers
|diff -u l2/at_ethtool.c l2.fixed/at_ethtool.c
|--- l2/at_ethtool.c 2007-04-20 09:34:48.000000000 +0200
|+++ l2.fixed/at_ethtool.c
Thats the same even if i rename src to l2, so that l2/at_ethtool.c exists. -
How do I call a class file in my code?
Hi,
I have defined a class, 'WFLTrigger', in a file named WFLTrigger.java. I need to call a method of another class, 'importFile', from within the 'WFLTrigger' class. The 'importFile' class is hard-coded in another file named importFile.java.
The following is the code snippet I use in the 'WFLTrigger' class to call the 'importFileMethod' method of the 'importFile' class.
importFile impF = new importFile();
impF.importFileMethod( clientX, session, "0b0007d58001c142", theFile );
But, while compiling, I am getting an error:
cannot find symbol.
symbol : method importFile()
location: class WFLtrigger
importFile( clientX, session, "0b0007d58001c142", theFile );
1 error
Can anybody help me out here as to what is going wrong?
Thanks,
ArunHi Paul,
Thanks for the reply. In fact, I initially had the line of code:
importFile( clientX, session, "0b0007d58001c142", theFile );
Then I changed it to the snippet that I posted. I am using NetBeans 4.0 IDE on Windows 2000 SP4 OS.
I am posting my entire code below:
import com.documentum.fc.client.*;
import com.documentum.fc.common.*;
import com.documentum.com.*;
import com.documentum.operations.*;
import com.documentum.fc.client.IDfSysObject;
import com.documentum.fc.client.IDfType;
import com.documentum.fc.common.DfId;
import java.util.* ;
import java.lang.Integer;
public class WFLtrigger
public WFLtrigger(String[] args)
IDfClientX clientX = new DfClientX();
IDfClient client = DfClient.getLocalClient();
IDfSessionManager sMgr = client.newSessionManager();
IDfLoginInfo loginInfo = new DfLoginInfo();
loginInfo.setUser("abc");
loginInfo.setPassword("xyz");
loginInfo.setDomain("");
sMgr.setIdentity( "pqr", loginInfo );
IDfSession session = sMgr.getSession( "pqr" );
IDfFile theFile = clientX.getFile( "C:\\wet" );
importFile impF = new importFile();
impF.importFileMethod( clientX, session, "0b0007d58001c142", theFile );
NetBeans does not compile it. It gives an error as stated in the post above at the 2nd last line.
I appreciate any help on this.
Thanks,
Arun -
Problem in accessing class file for applet code
I am developing a package in struts frame work.
I place all the java files in action folder and jsp files in jsp folder.In one of the jsp I write code to invoke applet .But I am getting error as "class not found exception".Can any one help me? Below I am giving the code?
<embed
type="application/x-java-applet;version=1.4"
pluginspage="http://java.sun.com/products/plugin/index.html#download"
code="DigitalSignerApplet"
archive="DigitalSignerApplet.jar"
width="130"
height="25"
mayscript="true"
scriptable="true"
fileNameField="uploadFile"
certificationChainField="certChain"
signatureField="signature"
signButtonCaption="Sign selected file">
<embed>Excuse me with out files in webserver how can I get
error, I am asking how to point to that specific classHuh? You can't. It's an HTML page with an applet. All normal rules apply. -
How to calculate averages and send to a file?(source code)
Having trouble the book isn't very clear on how to use averages.............could some give me an example of a program..................that gets averages and send to a file..........?
From Deitel and Deitels monster 'How to Program' :
import javax.swing.JOptionPane;
public class Average {
public static void main ( String args[] )
int total, gradeCounter, gradeValue, average;
Swing grade;
total = 0;
gradeCounter = 1;
while ( gradeCounter <= 10 ) { //assuming 10 values
grade = JOption.showInputDialog ( "Enter grade: " ) ;
gradeValue = Integer.parseInt ( grade );
total += gradeValue;
gradeCounter = gradeCounter + 1;
average = total / 10;
JOptionPane.showMessageDialog (
null, "Class Average is" + average, "Class Average",
JOptionPane.INFORMATIOIN_MESSAGE );
System.exit ( 0 );
Import package java.io
Three stream objects are created when you execute , System.in, System.out, System.err
System.out can be directed to send it's output to a file or disk. -
Compile class file, check for code structure quality
now i am trying to develop a system for my college final year project..the main function is to help the lecturer to mark the student java assignment
any way to compile the java file..just to check for the error? if got error then 0 mark..no error got mark..and then check for the code structure and so...base on that ..to decide the student mark..like if good structure 20 mark..bad? 5 mark and so.
is it possible to do so?
Junit?
any sample?Checking for errors is easy, just write a script to check if javac completed successfully. You can use similar approaches (possibly needing to parse the output) for jlint/PMD/whatever to check code structure. If there's any custom checks you want to do, though, I suggest you grab a parser (possibly witgh semantic analysis; I've found the Eclipse one is rather easily extracted and is good for this stuff) and write manual checks. It might be easier to write PMD rules, but you won't have the flexibility.
-
Organizing class files (in the filesystem)
Hi, I'm new to Java and the JDC. I have run into one issue, in my explorations in Java, and that is organizing the class files and source code files. I understand that I can organize them in any way that I like, but I was curious if there is a standard system that other Java developers use (like the /usr/local convention on Unix).
Should I create a /usr/local/java directory and then store class and source files in subdirectories of that? And then add the class directory to the CLASSPATH? How about downloaded source code that I didn't write -- that seems like it would then go in yet another directory.
So far I've got everything stored in ~/dev/java (a directory I created for this purpose), but it seems like it's bound to get unmanageable if I don't order it better. And I'm just curious what others with more experience do.
Thanks!
ErikAnyway, back to why. If as you mentioned you keep all of your class files off a given root folder, then you can add that folder root to the classpath.
Okay, I have the domain "erikprice.com". So then I would create a hierarchy like this (?) :
- ~
- dev
- Java
- com
- erikprice
- packageA
- packageB
- packageC
...etc...And then, if I add ~/dev/Java/com to my CLASSPATH, all of the classes in the various packages below that will be accessible to the compiler? Or do I have to explicitly put ~/dev/Java/com/erikprice into the classpath?
Also, if I have downloaded someone else's source code (such as a Jakarta project or something), it seems like I should put its root folder in with my personal root folder. In other words, like this:
- ~
- dev
- Java
- com
- erikprice
- org
- apache
- xml
- xerces
- packageA
- packageB
- xalan
- packageA
- packageB
...etc...Does this seem right? If I understand correctly, I will have to add the org directory to the CLASSPATH too. Can I save all of this trouble by putting just ~/dev/Java into the CLASSPATH so that all of the packages below (com/erikprice/*, org/apache/xml/*, org/someotherproject/*) are available?
The trick of this is that I'm trying to organize both my own Java files as well as those that I've downloaded to study from. Thanks for your input, MLangstaff. -
*Added* code to existing source file, compiled it, and class file shrunk
Another newbie here. Fortunately, my classpath is ok, so I'm able to compile a .java file.
I added one line of code (System.out.println) to write the value of a variable to a log. After compiling with javac, I noticed that the resulting [new] class file was smaller than the existing class file. I looked at each of the class files with Textpad. It's gibberish, but I quickly saw that a large block of code was missing in the new class file, even though the size of the source file had been increased.
There is a difference, however, between how the two class files were created. The existing class file was compiled (along with many others) by exporting an .EAR file from a development environment (WSAD) to the WebSphere Administrator Console. Conversely, I am now compiling the same source file with javac on my machine.
I suspect that this is the reason why I can add code to a .java file, compile it, and have the resulting class file actually lose code. Even if I am correct, I don't know what to do about it.
Does anyone have an idea?
Regards,
Daniel T.Thank you both for your replies. I've read many posts over the past few months, and I know how important it is to provide as much info as possible, when asking a question here. That said, I have another tasty tidbit...
After replacing the existing (larger) class file with the new (smaller) class file, my application now produces this:
"*Error 500: LinkageError while defining class*..." [name of class]
*"...(Unsupported major.minor version 50.0) This is often caused by having a class defined at multiple locations within the classloader hierarchy. Other potential causes include compiling against an older or newer version of the class that has an incompatible method signature. Dumping the current context classloader hierarchy: ==> indicates defining classloader ==>[0] com.ibm.ws.classloader.CompoundClassLoader@6bd156d5 Local ClassPath:"*
...[the entire classpath]...
Original exception--- java.lang.UnsupportedClassVersionError:
I'm guessing that my focus should mostly be on the 'Original exception', and maybe I need to revisit the JRE or JDK or JVM (these terms are somewhat nebulous to me, so please forgive me using them interchangeably) on my machine. For now, I'll just keep trying stuff. Thanks again for the replies!
Regards,
Daniel T. -
Converting class files into java source codes
Dear Friends,
It is true that conversion of class files to its java source codes is possible through some software. I want to know, is there any way to protect my java source codes from viewing or copying illegally by other persons ?
If I create JAR file from java files, can it be also convertible back to source codes ?
AviYou can use code obfuscators in order to protect your code. And yes a jar file can also be decompiled.
http://www.retrologic.com/
http://www.2lkit.com/products/2LKitObf/
http://www.codingart.com/codeshield.html
http://www.drjava.de/obfuscator/ -
Attaching source code of jar files in ecllipse edidor
Hi all,
i want to attach source code for jre system library 1.5 while i am using ecllipse 3.2. i also want to attach other source code for struts.jar .
but i am unable to do it.
my another problem is that i have struts.jar 1.2.9 and source code for that version is not available on the apache site.
so please help me to attaching source file with jar files.
thanks.source code for jre system library 1.5 under eclipse: Window -> Preferences ->
Installed JREs -> here add JDK and not JRE
(that's all !!)
source code for struts.jardownload struts.xxx-src.zip from struts web site the
add it to your struts project repository. Write some
code that uses the struts API then select a struts
class (ActionForm for example) and hit F3 keyboard
key. Finally, click the button Attach
Source... and select struts.xxx-src.zip you've
just downloaded.
do the same thing for all other jar which have a
source code
hope that helpsRather than change JVMs to do this, you could just follow java_2006's instructions for the JRE, looking for the source inside the folder where your JDK is installed. It's in a file called src.zip -
Create Global Class Definition using Local Class Source Code
I would like to be able to automate the creation of global class definitions using source code that is defined in a text file (one example: convert a local class def to a global class def).
Does SAP deliver this functionality? (I'm already aware of the various classes that can be used to create global classes and how those classes can be implemented in a program to generate new classes. I'm hoping to avoid having to create a custom solution.)
Thanks in advance!We have a winner!
Thanks Rich!
It's not a 100% solution - I was hoping to be able to generate global classes/interfaces using source code alone, without requiring user intervention.
It <i>is</i> however, a 90-95% solution because debugging SE24 reveals that by using a combination of the FM's SCAN_ABAP_OBJECTS_CLASSES & SEO_CLIF_MULTI_IMPORT, I should be able to <u>quickly</u> put together that custom application that I was trying to avoid.
I knew about the existance of SEO_CLIF_MULTI_IMPORT but I did not know about SCAN_ABAP_OBJECTS_CLASSES. I'm very happy to learn that I'm not going to have to write a parser! -
Need to view source code for API classes
Any tips on where to find the .java files or source code for Java 2 5.0 classes?
With Java being open source, you'd think that it woud be easy to find this. But I've tried doing a few searches but te results haven't been helpful.
Cheers!Yeah I think I found it. Unfortunately there's a problem with downloading from Sun at the moment; fatal exceptions on every attempt.
Wait and try later, I guess.
Maybe you are looking for
-
Hasn't worked since the day I got it - the day it came out, but hasn't bothered me until now when I actually need to send one. I can receive but not send - I've turned it on and off, checked all the settings and called O2, but no luck. Any other idea
-
Nokia C3-01 Problem with Marking messages in Inbo...
include message marking features in In box for next device software Updates... thnx...!!
-
Hi I'm an owner from Scotland. For the past week + the Browser function on my BlackBerry has not been operational. After selecting the Browser option the BlackBerry screen appears with "Requesting...", while the blue bar slowing fills up. Eventually
-
G4 does not accept my network password
All of a sudden, my ibook g4 does not accept my network password. My mac mini (also on my network) accepts it just fine. I restarted my network but the same problem occurs. Help please!
-
Way to detect that Submit didn't finish ?
I have a form that uses the "hidden submit button" technique. Whereas, the visible Submit button is a regular button that performs some addt'l validation before exec'ing the click event on a real, hidden submit button. What I would like to do is to d