.Jar to Java code
Hello,
I've recently found out some old jar files that i had created and i need to reverse them to get the (well, almost) original java code that i had wrote.
Is there any way to do this?
Thanks in advance
Google java decompiler
http://www.google.com/search?hl=en&q=java+decompiler&btnG=Google+Search
Similar Messages
-
Verifying signed Jar using Java code
Hi,
I have been looking for a way to verify signed or unsigned jar from java code.
I have to use the jar name and from here, I have to verify the digital signature. For this goal I have found some Java classes which can be useful for me. These classes would be JarEntry class, from which I could get the certificates. Signature class, whose methods let me verify the digital signatures, and Certificate class. I also found a class called SignedObject from I could get the signature data which the method getSignature (), but the problem here it is that I need a private key in the SignedObject constructor, which is not possible since I want to verify a signed jar which I am not able to know the private key, just public key. So, could anybody tell me how I could solve this problem?
My code would be some as shown below:
jar = new JarEntry (location);
jarcertificates = jar.getCertificates();
/* We should check all the certificates
if (jarcertificates != null){
for (int i=0;i<jarcertificates.length;i++){
sig.initVerify(jarcertificates);
sig.update(jar.getExtra());
sig.verify( DIGITAL SIGNATURE FROM JAR SHOULD BE HERE);
I guess that I have to use jar.getExtra () in order to get the data to put in Signature.update() method but I am not sure, am I wrong?
Thanks in advanceHere is some sample code to verify a jar file:
JarFile jf = new JarFile(args[0], true);
byte[] buffer = new byte[8192];
Enumeration e = jf.entries();
ArrayList entries = new ArrayList();
while (e.hasMoreElements()) {
JarEntry je = (JarEntry) e.nextElement();
entries.add(je);
InputStream is = jf.getInputStream(je);
while (is.read(buffer, 0, buffer.length) != -1) {
// we just read. this will throw a SecurityException
// if a signature/digest check fails.
is.close();
}To validate the certificate chain, you can call JarEntry.getCertificates(), create a CertPath from the array of Certificates (using a CertificateFactory), and then use the CertPathValidator APIs. For more information, see the PKI Programmer's guide: http://java.sun.com/javase/6/docs/technotes/guides/security/certpath/CertPathProgGuide.html -
Executing jar from java code, then kill parent java code
Please suggest if there is any best way around on executing jar from java code then killing parent java code.
a) I have desktop based java application say "Monitor.java" which runs every 5 minutes.
b) How can I START external java application say "execute.jar" from Monitor.java THEN EXIT Monitor.java
I tried various options using "ProcessBuilder" and calling bat file but I need Monitor (parent application to EXIT, immediately after calling child (execute.jar)
Try1) ProcessBuilder builder = new ProcessBuilder("java -jar execute.jar");
Process process = builder.start();
Try2) Runtime r = Runtime.getRuntime();
Process p = null;
p = r.exec(new String[] { "cmd", "/c", "start C:/temp/Test.bat" });I have a requirement to transfer data from one db to another db from Java Application Layer.Maybe, maye not. We get all sorts of weird "requirements" - which are nothing but thoughts or proposed solutions.
But,
Did the "requirement" mention whether the table existed already or not in the target database? - If not, did it tell you to create it - drop/create it?
Did the "requirement" deliver some explanation to why this copying was neeeded? - Are we talking replication? - Or a one time cloning?
Etc, etc,
Personally I would always argue against a "reuirement" like that. - It just isn't the way to do it. Period.
Regards
Peter
P.S: If you are satisfied with what COPY does, then you could let Java make an OS call and do it from there? -
Is it possible to open a Jar within Java code
Hey
I am just wondering if it is at all possible to get java to run a Jar within the code. So the Jar is my update to my program and I have got it downloading from my site using the java code but now i want the code to open it for the user so they don't have to double click in on. Is this possible?
ThanksSure. The java.util.jar package.
You might want to take a look at service providers:
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%20Provider -
Static initialization of java code included in the Imported Archives jars?
Hi
Does SAP PI 7.0 support static initialization of java code included in the Imported Archives jars?
Static block of a java class included in the Imported Archive jars throws a Runtime Exception called ExceptionInInitializationError while trying to run.
Regards,
RDSHave you tested the code outside PI?
-
Invoke jar main method in java code
hi
i have a jar that has a usage like this
java -jar helper.jar arg1 arg2 etc...i want to invoke this helper main method in my java code.i've tried using reflection but it didn't quite work...
String[] args = new String[]{"arg1","arg2"};
Class c = Class.forName("com.helper.MainClass");
Method mainMethod = c.getMethod("main", args.getClass());
int mods = mainMethod.getModifiers();
if(mainMethod.getReturnType() != void.class || !Modifier.isStatic(mods) || !Modifier.isPublic(mods)) {
throw new NoSuchMethodException("main");
mainMethod.invoke(null, args);
Exception in thread "main" java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Test.callJarMain(Test.java:50)
at Test2.main(Test.java:34)thoughts???phychem wrote:
i want to use this jar in a non-static way.
public void useJar(String args[]){
//somehow invoke jar method here...
Sorry, I still don't get it. I don't know what you mean by a non-static way of using jars. The main method for launching an application is static so if you call that method, you will be using a static method. I don't know what you mean by a "jar method" either. Methods are inside classes. So far, all I can guess is you want to invoke a method in a class that happens to be inside a jar. Since people do this all the time without reflection, I don't see the problem. -
Running .jar files from Java code
Hi.
I am designing a sort of platform to run some games which are saved in .jar files. Basically this platform is a menu from which the user can select the game which he/she wants to run. It also has the feature of adding new games.
Is is possible to run the .jar file from within java code?
Thanks for any help!
Krt_maltaJust list the jar in the classpath list and call the class in the jar.
-
Can I change the Jar contents trough Java code ?
It may seems a little bit wierd, but it could solve a lot of acessibility problms....
Can I change/set the jar contents using java code ?
My real problem: I'm creating a EDI Client and using a XML file as configuration file. It's running well but this XML is much exposed to unauthorized users....
Can I set a value in this XML file if it is inside a jar file ??you can look at class JarOutputStream . You could also use class RunTime to just create a new jar with the proper files via the normal jar command.
-
How can i rename a jar file using only java code
i have tried everything i can think of to accomplish this but nothing works.
ghostbust555 wrote:
In case you geniuses haven't realized I said I tried everything I can think of not that I tried everything. So help or shut up I realize that I didn't try everything but if you can't figure it out either DO NOT POST.
And the question is how can i rename a jar file using java code? As it says in the title. Read.I would tell you to use the File.renameTo method, but surely that would have been obvious, and you would have tried it already? But maybe you didn't. You were kind of lacking in details in what you tried.
And yes, I am a genius. Just don't confuse "genius" with "mind-reader". -
Signing Jars from within Java Code
Hi,
I would like to sign a jar file from within my Java code. Reason for this is that I wish to update a jar file at runtime, throw away the class loader that loaded the jar, and load the updated code inside a new classloader.
One problem, however: The jar file has to be signed before loading it. How can I do this from my Java program? Or do I need to have the jarsigner tool available at the location where I resign the jar?
Thanks in advance,
Ronald.Hi,
In the meantime I found an answer to my problem. In rt.jar there exists a class sun.security.tools.JarSigner, which can be used for exactly this purpose. Not completely portable, but it'll do the trick.
Ronald. -
Hi,
My CDC application run in Windows Mobile, with Creme JVM.
I need from my java code, run other .jar. and later, finish may application atual.
I try like this:
Runtime.getRuntime().exec("\\Windows\\CrEme\\bin\\CrEme.exe -jar \\Windows\\sample\\cube.jar");
System.exit(0);
But my second jar its not started. Anybody can help me?
Other question, If I getRuntime(), am I using the atual instance of my JVM. If I exec other JAR, and later exit() my atual, the second jar its exit too?
I'm building a automatic upgrade module in my application. With Hessian (Web Service), I download my new jar. But, I need have other jar, start it and close my jar atual. My second jar showld be delete my atual, rename the new jar downloaded for the standard name, and later start the jar download, how new version.
thanks,
Fabio
Edited by: FabioPinheiro on Mar 28, 2008 4:41 AMHi all,
The Mr. Rene (from NSIcom) answer my question
Just
Add flag -mi.
(multiple instance)
I try and work fine.
thanks Rene..
Fabio -
How to launch Jar file in Mac Os using java code??
can anyone tell me how can i launch another jar file in my apllication using java code.
define "launch".
- You want to run a new java program in a separate process? (see Runtime.exec())
- You want to run a method in a specific class in the jar? (add jar to application classpath and then simply instantiate the class and call the method) -
OpenScript/How to add .jar file to Java Code in relative path
Hi all,
I want to add a .jar file which can be executed separately (like "java -jar A.jar") to my recorded Java Code.I've read this wiki http://everest2.us.oracle.com/wiki/Generic_JAR_Project about how to add a .jar file to "Assets", however, I cannot figure out how to use the .jarr file in Java code,I mean , how to get this .jar file like the method the databank added in "Assets"?
Things I did are as followed:
1.Execute my .jar file in OpenScript Java code with absolute path like this:
String cmd = "C:\Users\A.jar";
Runtime.getRuntime().exec(cmd);
This does work, but must set a absolute path in Java code like "C:\User\A.jar" ,which is not the workaround I want (I need my scripts can be run on other machines).
2.Try to get its current path with following codes:
File directory = new File(".");
String currentPath=directory.getCanonicalPath();
However,though this can get its absolute path (which is the the project path) in Eclipse like "C:\Users\Workspace\testProject", this only gets "C:\OracleATS\openScript" in OpenScript.
I thought to copy my .jar file to the project path , got its current path in java code first,then can know the path of .jar file, but this workaround failed because of the above reason.
I notice that in the "Assets" there are "Databanks","Object Libraries","JAR Files","Scripts". Since the databanks and scripts that added to "Databanks" and "Scripts" can be got or run in Java Code like:
*getDatabank("DatabankName").getNextDatabankRecord(); String data = eval("{{db.DatabankName.data}}");*
*or getScript("ScriptName").run();*
*Is there a method to get and run the jar file added to "Assets\JAR Files" like the above?*
Thank you very much!
Regards,
AngyoungHi DM,
Thanks for your reply!
I've found a workaround,which is calling OpenScript's APIs ,such as this.getScriptPackage().getRepository() and this.getScriptPackage().getWorkspace(),etc to locate the .jar file.
And this workaround can still work even though the script is run on other machine.
Sorry to reply you so late!
Regards,
Angyoung -
I am a Java noob guys, but we have java code the calls an Oracle Function. This code is unchanged from what successfully runs against an Oracle 9.2 database returning, in this case, one row from the database. A ref cursor is used. When the same Java code calls the same ref cursor function from a 10.2.0.1 database, a null resultset occurs. The function correctly returns a single row when executed by the same database user via sql-plus. So it must be a java thing. Does the jdbc driver need to be upgraded to correctly run against a 10.2 database? And is this null resultset type of anomaly a potential result of having a wrong version of ojdbc14.jar? Nothing else has changed except pointing the code to the same package and tables in a 10.2 database.
Thanks in advance for your comments.
Phil McDermottI realize now that this is the wrong forum to post in, but I was linked here from a google search on the issue.
I downloaded the 10.2.0.1 ojdbc14.jar from oracle, but the problem persists.
yeesh! now what? -
How to use Java code signing certificate in oracle 11i
Hello,
I am try to configure java code signing certificate in 11.5.10.2 application. we got java sign certificate from verisgin. SA's imported the certificate and created alias XXX_XXX with password and passphrase.
I am able to see the my certificate. keytool -list -v -keystore xxx_xxxx.jks -storepass Password.
how do I use it. I am using Enhance Jar Signing for EBS DOC ID 1591073.1.
could you please give me some advice on it?
Thanks
PrinceHussien,
I find out apps keystore keypassword and storepassword, I imported the java code sign certificate. I generated Jar files through adadmin, but I am getting warning error
adogif() unable to generate Jar Filers under JAVA_TOP.
executing /usr/jdk/jdk1.6.0_45/bin/java sun.security.tools.JarSigner keysotre **** -sigfile CUST Signer /apps/......
Error JarSigner subcommand Exited With status 1.
No standard output from jarsigner JarSigner error output: Exception in thread "main" java.lang.NoClassDefFoundError: sun/security/tools/JarSigner Caused by: java.lang.ClassNotFoundException: sun.security.tools.JarSigner at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: sun.security.tools.JarSigner. Program will exit. WARNING: The following path(s), defined in /apps2/property/product/tst/appl/cz/11.5.0/java/make/czjar.dep as elements of the output: oracle/apps/cz/runtime/tag WARNING: Copying cztag.lst from the old fndlist.jar ... About to Analyze flmkbn.jar : Fri Nov 22 2013 10:45:51
Please let me know if you have any idea. Thanks Prince
Maybe you are looking for
-
i need to know what comm port to set up my psk31 to transmit to my ft897d hf radio i cannot find how to get to the proper area to set it up in win 8.1 i cannot transmit without the port setup
-
MacBookPro running 10.8.5 fails to wake from sleep or kp???
Folks: I installed ML 10.8.5 a couple weeks ago in a separate partition from SL 10.6.8, and more or less things have been OK. Today, however I'm wondering if 10.8.5 has a "Rip van Winkle" type "glitch" that causes problems with the unit waking from
-
I haven't had issues with this in the past and I've checked the different modes the layers are in as well as the brushes are in. I've also checked spacing to make sure it isn't wrong. An example of what it is doing, would be to use the brush tool a
-
What is it with the Skype website anyway?
I have tried from several computers to buy a $2.99/mo Canada/US unlimited Subscription. When I click the Buy button the Internet Explorer logo on the tab just spins and spins forever. I do not have popups blocked. I have also tried it using several S
-
OS 10.7.4 & E-Mail Account on Exchange Server
Since updating to OS 10.7.4 last week, Apple Mail on my MacBook Pro has been unable to send or receive mail from my office account on Microsoft Exchange Server 2010.l The account is recognized because when I deleted and re-created it using my e-mail