Access JAR File while running App with Java Web Start

Hello guys,
I want to delpoy my application so that I can run it when I click on the appropriate button in a web page.
I have a Jar file for all the files that the app needs. No, not all of the files are included.
Indeed, I use JAR files such jdom.jar or postgres...jar that I must use in within my application.
How can I access these JAR files knowing that I can't point to files in a JAR file A from within a JAR file B, if the JAR file B contains the JAR file A?
The main JAR file that I put on the web server can be seen as the JAR file B and the other JAR files must be stored somewhere for the java classes within the main JAR file to have access to them.
I wonder whether there is another way to structure the project.
Thanks.

Hi Andrew.
I have followed your suggestions and here is what my .jnlp file look like:
<tt>
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/koedops" href="beta.jnlp">
     <information>
          <title>KOEDOPS</title>
          <vendor>Pr. Fischer</vendor>
          <homepage href="http://localhost:8080/" />
          <description>Downloading koedops with Java Web Start</description>
     </information>
     <resources>
          <j2se version="1.6+" />
          <jar href="beta.jar" main="true"/>
          <jar href="jcalendar-1.3.3.jar" />
          <jar href="jdom.jar" />
          <jar href="postgresql-8.4-701.jdbc4.jar" />
     </resources>
     <application-desc main-class="general.Application" />
</jnlp>               
</tt>
The three other jar-files reside in the same directory as the .jnlp file and the beta.jar file on the tomcat server.
When I launch the application though nothing happens upon the download. In contrast, if I change the main class to a class file that requires no extra library, it runs perfectly.
I can't be sure whether the jar-files are successfully accessed.
Regards.
Edmond

Similar Messages

  • Err. in programs copiled with Jdev 9.0.3 and run with Java Web Start

    Hi all,
    when I build my programs with Oracle9j JDeveloper 9.0.3.988 and I use them with Java Web Start, programs do not run, while when compiled with Oracle9j JDeveloper 9.0.2.x it runs without problems.
    The Java version used in both cases is 1.4.0.
    Here's an example of the log from Java Web Start:
    Error in JavaWeb Start
    viewer/imageViewer/ViewerAppState$1 (Illegal Variable name " val$files")
    java.lang.ClassFormatError: viewer/imageViewer/ViewerAppState$1 (Illegal Variable name " val$files")
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at com.sun.jnlp.JNLPClassLoader.defineClass(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader.access$1(Unknown Source)
         at com.sun.jnlp.JNLPClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
         at viewer.imageViewer.UtilityMenuPane.jbInit(UtilityMenuPane.java:167)
         at viewer.imageViewer.UtilityMenuPane.<init>(UtilityMenuPane.java:155)
         at viewer.imageViewer.UtilityMenuPane.getInstance(UtilityMenuPane.java:147)
         at viewer.imageViewer.ImageViewerFrame.jbInit(ImageViewerFrame.java:179)
         at viewer.imageViewer.ImageViewerFrame.<init>(ImageViewerFrame.java:145)
         at viewer.imageViewer.ImageViewerFrame.getInstance(ImageViewerFrame.java:126)
         at viewer.ImageViewer.execute(ImageViewer.java:30)
         at viewer.Viewer.execute(Viewer.java:63)
         at viewer.Viewer.<init>(Viewer.java:27)
         at viewer.Viewer.main(Viewer.java:40)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sun.javaws.Launcher.executeApplication(Unknown Source)
         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
         at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
         at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
         at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:536)
    Does anybody know why this happens?
    Thanks

    Hi There.
    We had the same problem with some of our code. We moved the definition of the class from a method out of the method. Like this:
    public class{
    class{
    instead of doing this:
    public class{
    method() {
    class{
    This worked with the web start......
    Best regards
    Jesper Lorentzen

  • JFrame running with Java Web Start

    I have a problem with running my application with Java Web Start. My main application window is a JFrame and I have a line of code as below
    this.setExtendedState(MAXIMIZED_BOTH);
    It runs fine when run on a PC locally. But if I try to run the application through Java Webstart I get an exception. Can anyone help me with this. I would like the JFrame to open maximized.
    TIA.

    try posting the exception to get better answers. but anyway, i'm guessing its a security issue... your app is trying to access the properties of the local system. you might have to sign your application for this to go away.

  • How import policy file with Java Web Start

    hi everybody,
    I wrote an application launched by Java Web Start.
    This application encrypt data on the client side and POST them to the server.
    To encrypt I use JCE packages including sunjce_provider.jar, jce1_2_1.jar and
    local_policy.jar and US_export_policy.jar.
    local_policy.jar and US_export_policy.jar are not packages, each of them contains
    a policy file.
    When I test encryption on local no problem, but when I test with Java Web Start
    I've got this exception :
    java.lang.ExceptionInInitializerError:
    java.lang.SecurityException: Cannot set up certs for trusted CAs
    It's because the application launched by Java Web Start doesn't find local_policy.jar
    and US_export_policy.jar.
    There's a problem in my JNLP file :
    <jnlp spec="1.0+" href="http://myserver/sources/test.jnlp" codebase="http://myserver/sources">
         <information>
              <title>Java Web Start TEST</title>
              <vendor>NLE Intech</vendor>
              <description>cryptage then upload</description>
         </information>
         <security>
              <all-permissions/>
         </security>
         <resources>
              <j2se version="1.3" />
              <jar href="sunjce_provider.jar" />
              <jar href="jce1_2_1.jar" />
              <jar href="local_policy.jar" />
              <jar href="US_export_policy.jar" />
         </resources>
         <application-desc main-class="HelloWorldSwing" >
              <argument>c:\myfiletoencrypt</argument>
         </application-desc>
    </jnlp>
    thank you for your answer

    Hi Nicolas,
    If you migrate to JDK1.4 and use the signed Bouncy JAR, you could resolve the problem,
    if you don't want to use unlimited cryptography.
    See my posting on your other question.
    Agnes
    PS. There is a mistake in my other reply, the "local_policy.jar" and the other files must have
    to go into JRE/LIB/SECURITY directory

  • I can't open or save file with Java Web Start

    Hi,
    i can't open or save file with Java Web Start:
    import java.io.*;
    import java.util.*;
    public class MetaDataFileCreator {
    public String fileNameSpace = null;
    public String fileName = null;
    protected Properties file = null;
    public MetaDataFileCreator(String fileNameSpace, String fileName) {
    this.fileNameSpace = fileNameSpace;
    this.fileName = fileName;
    public void createMetaDataFile() {
    try {
    System.out.println("file METADATA");
    ClassLoader cl = this.getClass().getClassLoader();
    String nameFileMetaData = fileNameSpace + fileName + ".txt";
    FileOutputStream fileOS = new FileOutputStream(cl.getResource(nameFileMetaData).getFile());
    file = new Properties();
    file.setProperty("aaaaa", "aaaa");
    file.store(fileOS, "");
    fileOS.close();
    } catch (Exception e) {
    System.out.println("Error writing metadata-file: " + e);
    System.exit(1);
    e.printStackTrace();
    I have try also to open a file like this:
    ClassLoader cl = this.getClass().getClassLoader();
    file.load(cl.getResourceAsStream(nameFile));
    also like this:
    try {
    fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
    fss = (FileSaveService)ServiceManager.lookup("javax.jnlp.FileSaveService");
    } catch (UnavailableServiceException e) {
    fss = null;
    fos = null;
    System.out.println("Error with JNLP");
    System.exit(1);
    if (fss != null && fos != null) {
    try {
    // get a FileContents object to work with from the
    // FileOpenService
    FileContents fc = fos.openFileDialog(null, null);
    //FileContents newfc2 = fss.saveAsFileDialog(null, null, fc);
    // get the OutputStream and write the file back out
    if (fc.canWrite()) {
    // don't append
    os = fc.getOutputStream(false);
    } catch (Exception e) {
    e.printStackTrace();
    also like this:
    File f = new File((System.getProperty("user.home")+"x.txt").toString());
    FileOutputStream fileX = new FileOutputStream(f);
    OutputX = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileX, "UTF8")));
    OutputX.println(....
    but it doesn't work with Java Web Start.
    Can someone help me?
    How can I open or save file?
    thank you.
    Sebastiano

    Did you specify <all-permissions/> in your JNLP file? Did you sign your code? What error are you getting?

  • Problems with Java web start

    Hi All,
    I am facing a problem with Java Web Start. Which is the most appropriate version of JDK recommended for SAP XI? I tried
    JDK 1.4.2_04
    JDK 1.4.2_09
    JDK1.4.2_11
    JDK1.5.0_01
    When I click on Integration repository or Directory for the first time, it loads the jar files and while loading, I get an error msg "Unable to launch Integration Builder". After a lot of retries I get sucess. But still we are facing this issue in some machines. Can you pls let me know if there is any pre configuration or some thing I am missing...
    Regards,
    Jai Shankar

    Did you check the proxy settings in JAVA Web start. Please follow the below instructions.
    This could be set to None or to specific for values HTTP Proxy and HTTP Port .
    Contact your network administrator for the correct settings. 
    To change the Proxy Settings:
    Select Windows Start menu -> All Programs -> Java Web Start -> Java Web Start
    Choose File -> Preferences -> General
    Choose None to switch off the proxy settings or Manual to set the HTTP Proxy and HTTP Port.
    ChooseOK
    Close Java™ Webstart

  • Help with Java Web Start

    Hi everybody,
    I have a simple Java application that has a JFrame containing a TextField displaying some text inside it. I am using the NetBeans IDE. I am trying to Enable Java Web start for this application. The steps I have taken upto now are:
    1. Right click on Project, Java Web Start -> Enable Java Web Start. This created the jnlp file.
    2. In the Resources section, I added the jar file for swing. ( I am not sure if I have to add the path for jnlp.jar etc, or are these found automatically?)
    3. Right click on Project, Java Web Start -> Deploy with Java Web Start. This launches the browser with the Click me link, but on clicking this link, I get the following error.
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Wrapper cannot find servlet class jnlp.sample.servlet.JnlpDownloadServlet or a class it depends on
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.ClassNotFoundException: jnlp.sample.servlet.JnlpDownloadServlet
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
         org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
         org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         java.lang.Thread.run(Thread.java:534)I have all the jnlp files in my jdk directory, and I am not sure why it can't find it. Is there something I am missing?
    Thanks
    George

    I am not sure what it has to do with servlets, I just followed a tutorial on using Netbeans with Java Web Start, and did only the steps as mentioned in my first post. And ended up with the error.
    Anyways, I added the jnlp jar files(jnlp.jar, jnlp-servlet.jar, jardiff.jar) in the WEB-INF/lib directory. And it seems to deploying it now. I can get my application to load on clicking on the "Click me" link. But the controls on my application don't seem to be working.
    Also, when I try to Right click on my project -> Java Web Start -> Run with Java Web Start, I get the following error message,
    javaws-run: C:\Documents and Settings\Lux\Visualization\nbproject\build-jaws-impl.xml:36: Execute failed: java.io.IOException: CreateProcess: C:\j2sdk1.4.2_13\bin\javaws "file:///C:/Documents and Settings/Lux/Visualization/Visualization.jnlp" error=2
    BUILD FAILED (total time: 0 seconds)
    Any help appreciated.
    Thanks.
    George

  • Issue Downloading Resources with Java Web Start

    I'm having an issue with Java Web Start downloading resources. After executing the JNLP file, the download will start and the main Jar will download, then the download will just stop. The downloader is still running, but the progress bar just sits and nothing happens. This only will happen on some machines, even ones on the same network. Others download fine, and the application starts correctly. I thought maybe a setting with java web start needed to be changed, but the proxy settings are set to the browser, which are the same for all machines. The JNLP file is below (however, for security reasons the codebase/homepage are left out, but they are correct in the actual file). Does anyone have any idea of what the problem might be?
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
         <jnlp codebase="..." spec="1.0+">
         <information>
         <title>Java3D Test</title>
              <vendor>None</vendor>
              <homepage href="..." />
              <description>Test application for Java3D</description>
         </information>
         <update check="always" />
    <security>
         <all-permissions/>
    </security>
    <resources>
              <j2se version="1.5+"/>
         <jar eager="true" href="TestJava3D.jar" main="true" />
              <jar href="lib/Library.jar" />
              <jar href="lib/Java3D.jar" />
              <jar href="lib/j3dnative.jar" />
         </resources>
    <application-desc main-class="testjava3d.TestJava3DMain">
    </application-desc>
    </jnlp>

    You could enable JavaConsole and turn on tracing to get more debugging info. See: http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html#gcexdf

  • How to convert existed standalone APP to java web start app?

    hello:
    I didn't find useful information about how to convert an existed java
    app into app which can be launched using java web start from the sun java developer's guide.
    I have designed a simple java applcation and want to lauch this program with
    java web start techniques(on local machine only). Is there any easy way that i could convert my program to the one which support java web start, so i can double click the *.jnlp file to launch my java applcation.
    thank you
    -Daniel Mark

    i just found a great place to resolve my question.
    If you had the same question, please refer to
    http://www-106.ibm.com/developerworks/java/library/j-webstart/
    thank you
    -Daniel

  • Using Berkeley Java Edition with Java Web Start

    Hi
    Have anyone had any experience using Berkeley Java Edition with Java Web Start?. I need to create an application that will download with the database to a client computer and create the database there

    Thanks for your reply Luca-Sanna,
    This is my jnlp file
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/dist" href="launch.jnlp">
    <information>
    <title>MyApplication</title>
    <vendor>My Company</vendor>
    <homepage href="/test.html"/>
    <description>My Test Application</description>
    <description kind="short">My Application</description>
    <icon href="test.gif" kind="default"/>
    <offline-allowed/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="myapp.jar" main="true" download="eager"/>
    <jar href="lib/appframework-1.0.3.jar" download="eager"/>
    <jar href="lib/beansbinding-1.2.1.jar" download="eager"/>
    <jar href="lib/commons-beanutils.jar" download="eager"/>
    <jar href="lib/commons-collections.jar" download="eager"/>
    <jar href="lib/commons-digester.jar" download="eager"/>
    <jar href="lib/commons-logging.jar" download="eager"/>
    <jar href="lib/derby.jar" download="eager"/>
    <jar href="lib/derbyclient.jar" download="eager"/>
    <jar href="lib/derbynet.jar" download="eager"/>
    <jar href="lib/itext-1.3.1.jar" download="eager"/>
    <jar href="lib/jasperreports-1.3.0.jar" download="eager"/>
    <jar href="lib/jbossall-client-2004-05-11.jar" download="eager"/>
    <jar href="lib/jdt-compiler-3.1.1.jar" download="eager"/>
    <jar href="lib/poi-2.0-final-20040126.jar" download="eager"/>
    <jar href="lib/swing-worker-1.1.jar" download="eager"/>
    <jar href="lib/toplink-essentials-agent.jar" download="eager"/>
    <jar href="lib/toplink-essentials.jar" download="eager"/>
    </resources>
    <application-desc main-class="mypackage.Login">
    </application-desc>
    </jnlp>
    I have seen many forums with the same above problem with no reply.
    Anyone knows what exactly the problem is?

  • Using Xerces with Java Web Start

    I read that there might be problems using xerces with Java Web Start, because JWS uses Sun's implementation of JAXP internally. My application needs Xerces and I think I am able to get it working using the following settings in the JNLP file:
    <resources>
    <j2se version="1.3"/>
    <jar href="xerces-1.4.3.jar"/>
    <property name="javax.xml.parsers.DocumentBuilderFactory" value="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
    </resources>

    Hi,
    I have packaged the xerces jar into my code jar and it does work. HTH
    Aniruddha

  • Launching an applet with java web start

    Is there a way to launch an applet with java web start? That is, to have the java appelt run in a browser but get deployed with a jnlp-file and have all the benefits of java web start?
    Robert

    http://www.physci.org/jws/#jtest

  • How to run 64-bit native code with Java Web Start

    This question has probably been asked many times, but I couldn't find anything in my searches.
    How can I get Java Web Start on a Solaris client (Solaris 10 in this case, with JRE 1.5) to run a java application that includes a 64-bit native code library? The application downloads fine, including the jar file that has the native shared object, but when the native library is loaded by the java application, I get a "wrong ELF class: ELFCLASS64" error.
    I assume that is because Web Start is invoking the 32-bit java VM, which can't load a 64-bit library. I tried configuring Java Web Start to use the 64-bit VM (by setting the path to java to ".../jre/bin/sparcv9/java" in the javaws console) but then I get an error that says "Can't load library: .../jre/lib/sparcv9/libdeploy.so".
    Does Java Web Start support 64-bit native code, and if so, what do I need to do differently?
    Thanks.

    No it can't. On the Sun download page of the JRE it says that 64 Bit systems need to use the 32 Bit JRE to execute Plugins - this might be the same for Web Start apps.

  • Database access with Jave Web Start

    Can a java application, that has been deployed by using Java Web Start, access information from a database that's located on the web server from where the application was deployed?

    Yes, if you use the type 4 (ie, thin) driver and include the driver's jar file as part of the app.
    Technically you can do it with a thick driver but then you have first install the driver on the client machine and I assume this isn't what you are looking for,

  • Include JAR with Java Web Start?

    Hi,
    i am trying to deploy a little java web start application, that sends an email if you click on a button.
    If i now deploy the application as a java web start app,
    nothing happens, but if i run the little app as normal
    JClient app it sends the email.
    Is it possible, that java web start does not know, where
    the classpath is? And why isn`t throw an exception?
    Source:
    private void jButton2_actionPerformed(ActionEvent e)
    try
    HtmlEmail email = new HtmlEmail();
    email.setHostName("mail.anyserverintheworld.com");
    email.addTo("[email protected]", "Name");
    email.setFrom("[email protected]", "Name");
              email.setSubject("What do you think it this?");
    //          //          set the alternative message
              email.setTextMsg("Your email client does not support HTML messages");
    //          send the email
              email.send();
              }catch (Exception ex)
                   JOptionPane.showMessageDialog(Form.this,"laba",ex.toString(),JOptionPane.INFORMATION_MESSAGE);
    }

    Christian,
    if it can't find the classpath of something, then it wouldn't be able to find the classes comntained and throw a class not found exception. So there must be some sort of error message showing somewhere. If not, use System.out.println() to write your own debug statements.
    Another hint, instead of handling the Exception, throw it so that the Webstart console shows the stack trace. Maybe the problem you hit is a security issue of not being granted the permission to use sockets or network connections to send the email.
    Frank

Maybe you are looking for