Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I sign Java Class Files

I have a website that was professionally built about 8 years ago and generally works absolutely fine. It uses a Java applet to chart stuff and now Oracle is requiring all Java code to be signed. I have 2 problems:

  1. The company that built the site went bust in the credit crisis
  2. There is no Java file on the site it seems calls are made to the class files directly.

Site uses ASP.net and was built in Visual Studio. Question.. can the java class files be signed or is it only possible to sign a jar file?

thanks for your help! PS/ I'm a non-expert in Java but I built the original site before it was rebuilt 8 years ago, so you could say I'm a sort of relatively capable amateur!

like image 826
user3038695 Avatar asked Nov 27 '13 00:11

user3038695


People also ask

Can a class name start with dollar sign in Java?

Java naming conventions for variables, methods and reference types are where things get a little more complicated. For example, you can start a Java variable with a dollar sign or an underscore, but nobody does.

Why should you bother signing and validating JAR files?

You can optionally sign a JAR file with your electronic "signature." Users who verify your signature can grant your JAR-bundled software security privileges that it wouldn't ordinarily have. Conversely, you can verify the signatures of signed JAR files that you want to use.

Do Java classes need their own files?

According to Java standards and common practices, we should declare every class in its own source file. And even if we declare multiple classes in a single source file (. java), still each class will have its own class file after compilation.


1 Answers

You can package your classes in a jar file and sign the jar. Depending on how you are loading your applet in the browser, you may need to modify the HTML tag a little bit.

For more info on creating a jar file: http://docs.oracle.com/javase/tutorial/deployment/jar/build.html

For more info on signing a jar: http://docs.oracle.com/javase/tutorial/deployment/jar/signing.html

For more info on loading an applet from a jar Java Applet in JAR File

like image 133
user2626222 Avatar answered Sep 23 '22 22:09

user2626222