Skip to Main Content

Java User Groups

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Web Start (Unable to download dependency jars using JNLP)

Pankaj ShakyaMay 4 2017 — edited Jan 17 2018

I am trying to implement Digital Signature using bouncycastle. Previously i was using applet which runs inside browser, but now as firefox and chrome are no longer supporting NPAPI plugin.

Thats why i tried to implement this by using JNLP. But while i am running JNLP file, following exceptions are being displayed....

Reading the certificates for [TEST IIIB SIGN ENCRY - -2073519335 - -2073519335]

Certificate found for serial number [1396617742]

Length of content going to sign-----11075

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfReader: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfViewerPreferences: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfDictionary: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfObject: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PRStream: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfStream: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.exceptions.UnsupportedPdfException: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PRIndirectReference: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfIndirectReference: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfArray: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfNumber: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfString: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfName: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfNull: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfBoolean: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfLiteral: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.ExceptionConverter: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.exceptions.BadPasswordException: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.ByteBuffer: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfEncodings: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.ExtraEncoding: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.IntHashtable: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.IntHashtable$Entry: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfEncodings$WingdingsConversion: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfEncodings$SymbolConversion: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfEncodings$SymbolTTConversion: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfEncodings$Cp437Conversion: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.internal.PdfViewerPreferencesImp: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PRTokeniser: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.RandomAccessFileOrArray: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PRTokeniser$TokenType: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfReader$1: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.OutputStreamCounter: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.OutputStreamEncryption: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.DocWriter: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.DocListener: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.ElementListener: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfReader$PageRefs: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfStamper: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfEncryptionSettings: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfWriter: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfVersion: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfDocumentActions: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfPageActions: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfXConformance: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfRunDirection: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.interfaces.PdfAnnotations: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfStamperImp: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfAnnotation: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfFormField: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.DocumentException: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfICCBased: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPageEvent: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfDocument$PdfCatalog: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfOCProperties: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfXConformanceException: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfDocument$PdfInfo: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.xml.xmp.XmpWriter: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPattern: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfDestination: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfImage: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfException: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfContents: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPage: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Document: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfDocument: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfTemplate: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfContentByte: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfAppearance: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfRectangle: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfAction: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.collection.PdfCollection: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.FdfReader: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfImportedPage: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.StampContent: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfOCG: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.xml.xmp.XmpReader: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfDate: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Element: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfOutline: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfAcroForm: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.PageSize: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Rectangle: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.RectangleReadOnly: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.BaseColor: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.GrayColor: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.ExtendedColor: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfDocument$Indentation: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Meta: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPages: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.internal.PdfVersionImp: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.internal.PdfXConformanceImp: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfGState: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPSXObject: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.exceptions.IllegalPdfSyntaxException: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPrinterGraphics2D: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfGraphics2D: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Image: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfContentByte$GraphicState: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfWriter$PdfBody: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfWriter$PdfBody$PdfCrossReference: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.internal.PdfAnnotationsImp: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSignatureAppearance: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSignatureAppearance$RangeStream: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSigGenericPKCS: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSignature: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSigGenericPKCS$PPKLite: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSigGenericPKCS$PPKMS: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSigGenericPKCS$VeriSign: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSignatureAppearance$RenderingMode: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.AcroFields: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.BaseField: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PushbuttonField: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.AcroFields$RevisionStream: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.BaseFont: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.DocumentFont: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.TextField: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.CMYKColor: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.XfaForm: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.XfaForm$Stack2: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPKCS7: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfPKCS7$X509Name: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfBorderDictionary: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfBorderArray: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfColor: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfFormXObject: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PageResources: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfResources: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Font: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Font$FontFamily: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfSignatureAppearance$1: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Phrase: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.TextElementArray: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Chunk: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.ColumnText: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Paragraph: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.ListItem: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.List: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.BidiLine: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfChunk: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Font$1: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.TrueTypeFont: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.Type1Font: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.TrueTypeFontUnicode: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.CJKFont: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.BaseFont$StreamFont: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.fonts.FontsResourceAnchor: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.GlyphList: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfFont: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.DefaultSplitCharacter: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.SplitCharacter: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.Utilities: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfLine: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.FontDetails: try again ..

basic: JNLP2ClassLoader.findClass: com.itextpdf.text.pdf.PdfIndirectObject: try again ..

network: JARUpdater: update check for http://10.25.85.74:8080/PIMS/applet/dsc-1.0.jar

cache: Resource http://10.25.85.74:8080/PIMS/applet/dsc-1.0.jar has expired.

network: Connecting http://10.25.85.74:8080/PIMS/applet/dsc-1.0.jar with proxy=DIRECT

network: ResponseCode for http://10.25.85.74:8080/PIMS/applet/dsc-1.0.jar : 304

network: Encoding for http://10.25.85.74:8080/PIMS/applet/dsc-1.0.jar : null

network: Disconnect connection to http://10.25.85.74:8080/PIMS/applet/dsc-1.0.jar

network: JARUpdater: update check for http://10.25.85.74:8080/PIMS/applet/bcprov-jdk16-1.46.jar

cache: Resource http://10.25.85.74:8080/PIMS/applet/bcprov-jdk16-1.46.jar has expired.

network: Connecting http://10.25.85.74:8080/PIMS/applet/bcprov-jdk16-1.46.jar with proxy=DIRECT

network: ResponseCode for http://10.25.85.74:8080/PIMS/applet/bcprov-jdk16-1.46.jar : 304

network: Encoding for http://10.25.85.74:8080/PIMS/applet/bcprov-jdk16-1.46.jar : null

network: Disconnect connection to http://10.25.85.74:8080/PIMS/applet/bcprov-jdk16-1.46.jar

network: JARUpdater: update check for http://10.25.85.74:8080/PIMS/applet/bctsp-jdk16-1.46.jar

cache: Resource http://10.25.85.74:8080/PIMS/applet/bctsp-jdk16-1.46.jar has expired.

network: Connecting http://10.25.85.74:8080/PIMS/applet/bctsp-jdk16-1.46.jar with proxy=DIRECT

network: ResponseCode for http://10.25.85.74:8080/PIMS/applet/bctsp-jdk16-1.46.jar : 304

network: Encoding for http://10.25.85.74:8080/PIMS/applet/bctsp-jdk16-1.46.jar : null

network: Disconnect connection to http://10.25.85.74:8080/PIMS/applet/bctsp-jdk16-1.46.jar

network: JARUpdater: update check for http://10.25.85.74:8080/PIMS/applet/itextpdf-5.0.6.jar

cache: Resource http://10.25.85.74:8080/PIMS/applet/itextpdf-5.0.6.jar has expired.

network: Connecting http://10.25.85.74:8080/PIMS/applet/itextpdf-5.0.6.jar with proxy=DIRECT

network: ResponseCode for http://10.25.85.74:8080/PIMS/applet/itextpdf-5.0.6.jar : 304

network: Encoding for http://10.25.85.74:8080/PIMS/applet/itextpdf-5.0.6.jar : null

network: Disconnect connection to http://10.25.85.74:8080/PIMS/applet/itextpdf-5.0.6.jar

java.lang.NoSuchMethodError: org.bouncycastle.asn1.DERSequence.<init>(Lorg/bouncycastle/asn1/DEREncodableVector;)V

  at com.itextpdf.text.pdf.PdfPKCS7.getEncodedPKCS7(PdfPKCS7.java:1201)

  at com.itextpdf.text.pdf.PdfPKCS7.getEncodedPKCS7(PdfPKCS7.java:1151)

  at com.itextpdf.text.pdf.PdfSigGenericPKCS.setSignInfo(PdfSigGenericPKCS.java:107)

  at com.itextpdf.text.pdf.PdfSignatureAppearance.preClose(PdfSignatureAppearance.java:973)

  at com.itextpdf.text.pdf.PdfSignatureAppearance.preClose(PdfSignatureAppearance.java:897)

  at com.itextpdf.text.pdf.PdfStamper.close(PdfStamper.java:192)

  at org.nic.eoffice.dsc.util.DSCUtil.signFile(DSCUtil.java:1917)

  at org.nic.eoffice.dsc.applets.Signing.signFile(Signing.java:359)

  at org.nic.eoffice.dsc.applets.Signing.signFile(Signing.java:342)

  at org.nic.eoffice.dsc.applets.Signing.sign(Signing.java:176)

  at org.nic.eoffice.dsc.applets.Signing.start(Signing.java:43)

  at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.start(Unknown Source)

  at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)

  at java.lang.Thread.run(Unknown Source)

Ignored exception: java.lang.NoSuchMethodError: org.bouncycastle.asn1.DERSequence.<init>(Lorg/bouncycastle/asn1/DEREncodableVector;)V

====================================================================================================================

JNLP File:

<?xml version="1.0" encoding="UTF-8"?>

<jnlp spec="1.0+" codebase="http://10.25.85.74:8080/PIMS/applet" href="dsc-signing.jnlp;JSESSIONID=1E3ADB612BB4CC9EC3BAAB9DC1964FB7">

    <information>

  <title>Jnlp Testing With PIMS</title>

  <vendor>eOffice</vendor>

  <description>Testing Testing</description>

  </information>

  <security>

        <all-permissions />

    </security>

    <resources>

        <!-- Application Resources -->

        <j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"  max-heap-size="256m"/>

  <jar href="dsc-1.0.jar" main="true" download="eager"/>

  <jar href="bcprov-jdk16-1.46.jar"/>

     <jar href="bctsp-jdk16-1.46.jar"/>

     <jar href="itextpdf-5.0.6.jar"/>

  </resources>

   

   <applet-desc name="Applet" documentBase="http://10.25.85.74:8080/PIMS" width="300" height="400" main-class="org.nic.eoffice.dsc.applets.Signing"  >

  <!-- <param name="type" value="application/x-java-applet;version=1.7" /> -->

  <param name="permissions" value="all-permissions" />

  <param name="jsessionid" value ="1E3ADB612BB4CC9EC3BAAB9DC1964FB7"/>

  <param name="clientURL" value ="http://10.25.85.74:8080/PIMS/DSCServlet"/>

  <param name="java_arguments" value="-Xmx256m"/>

  </applet-desc>

     <update check="background"/>

</jnlp>

Please advice....

Comments

PhHein

MOD: moved from JDBC

966239

Could you elaborate please?

TPD-Opitz

No.

Java is no scripting language.

You need to translate the java source code to the intermediate language which is in turn interpreted by the Java Virtual Machine (JVM) at execution time.

The java compiler which does the translation from source code to IL code works with files in your file system. You cannot pass in a stream to be compiled. (at leest the existing implementations I know of).

So your shell script must write the code into a *.java file (with the exact same name as the class), pass that file to the javac executable and after that it could run the JVM (the java executable) with the resulting *.class file as parameter.

Step 1 and 2 are better done within a Java IDE.

bye

TPD

966239

When I took java 15 years ago, I could have sworn I saw our instructor execute a java command from the command line where he did the compile and the run at the same time with the main(String[] argv) method and a println enclosed in brackets. I think it was a hypothetical example to show that you could do it at the command liline because he was trying to use a visual example to show us parts of the main(String[] argv) statement.

Would you or anyone know about doing that?

TPD-Opitz

I didn't attent that class but it's quite easy to create a shell script that does the three steps in sequence.

But again, Java is no scripting language.

If you want a scripting language with Java syntax you should have a look at Groovie but on the other hand the java syntax is quite hard to handle in scripting environments. It's a bit too chatty...

bye

TPD

2894431

You can run a java class from a shell script like below:

#!/bin/sh

exec /usr/bin/java -DsysParam1="var1_val" -DsysParam2="var2_val" -cp jar1:jar2:jar3 /home/unixUserName/javaClasses/Test.java

exit 0

TPD-Opitz

2894431 wrote:

You can run a java class from a shell script like below:

#!/bin/sh

exec /usr/bin/java -DsysParam1="var1_val" -DsysParam2="var2_val" -cp jar1:jar2:jar3 /home/unixUserName/javaClasses/Test.java

exit 0

No!

This is neither a valid answer to the OPs question (since your script does not create the content of Test.java) nor working.

The java executable can only run *.class files which contain byte code of the intermediate language generated by the javac executable.

Your suggestion leads to a ClassNotFound exception.

bye

TPD

> When I took java 15 years ago, I could have sworn I saw our instructor execute a java command from the command line

Could be that the teacher wrote their own shell environment.

Or that you mistook an IDE for a shell.

Or, I believe at one time, there was an environment that did java scripting (there was one for C or C++ too) and perhaps that was it.

1 - 8

Post Details

Added on May 4 2017
6 comments
1,650 views