7 Replies Latest reply: Nov 30, 2006 11:08 PM by 843804 RSS

    java runtime parameter (-classpath)

    843804
      Hi,
      Does anyone know how to programmatically set the java-runtime-parameters?
      I need to set them to: "-classpath c:\jar\test.jar"

      My goal is to access test.jar thru the ActiveX Bridge, and test.jar is not inside the "applet" folder (nor the "ext" folder). Note: ActiveX bridge uses the java plug-in which has a default path to the applet folder, I need to programmatically set a java-runtime-parameter "-classpath" to c:\jar\test.jar...

      (I know that you can set the java-runtime-parameters thru control panel - java plug-in, but this will not work for what I am doing, I need to do it on the fly programmatically).


      Gene.
        • 1. Re: java runtime parameter (-classpath)
          843804
          I have this same issue. I cannot ship an application that is subject to the whims of whatever happens to be in the users lib/ext/ directory. I need to be able to explicitly indicate which jars to load.

          Does anybody have any ideas on how to prevent being at the mercy of what other applications have piled into lib/ext/?

          Using a custom ClassLoader fails because by the time the main JAR is loaded by the ActiveX Bridge it's too late to set.
          • 2. Re: java runtime parameter (-classpath)
            843804
            this is my solution...

            there's a file in C:\Documents and Settings\"user"Application Data\Sun\Java\Deployment - Deployments.properties; Just edit it from COM; i.e. if you add the line "javaplugin.jre.params=-classpath c\:\\jar\\test.jar" it will add test.jar to your class path... You can also do this thru the control panel, but it's nicer to do it programmatically, so that whoever installs it doesn't have to change any settings himself...
            • 3. Re: java runtime parameter (-classpath)
              843804
              Thanks. It's not pretty but it's probably better than what I am forced to do now.

              I can't believe the ActiveX Bridge/Java Web Start team didn't think of a better way to do handle this issue. It's a deployment nightmare.
              • 4. Re: java runtime parameter (-classpath)
                416044
                Is there any other solution? E.g. new feature in JDK 1.5 for this CLASSPATH issue?
                • 5. Re: java runtime parameter (-classpath)
                  416044
                  Neither the entry in the deployment.properties nor the setting un the Plug-in control panel works.

                  The only solutions that I have found working for now are:

                  1. copy JARs into JRE's lib/ext/ directory
                  2. copy classes into JRE's subdirectory "classes/" !!!
                  3. copy JARs into JRE's lib/applet/ directory

                  1. is bad as conflicts with other apps can occur
                  2. is bad as you can't dearchive all (3rd party) JARs because some files may overwrite each other (properties, etc.)
                  3. doesn't work for beans that access restricted ressources

                  So far, 1. is still the only working solution but can make problems with other Java apps. Even setting the classpath within the manifest doesn't work.
                  • 6. Re: java runtime parameter (-classpath)
                    843804
                    hi find this
                    • 7. Re: java runtime parameter (-classpath)Several Java Virtual Machines runnin
                      843804
                      People I have tried this after trying all that I could fine on the internet,
                      What did not work is as follows:
                      1) Setting "-Xmx512m", where "512" should be replaced by 3/4 of the system
                      physical memory size.
                      2) Also enable "<APPLET> tag support" for Internet Explorer. Apply settings.
                      This worked for some.
                      3) Also tried uncheking the box for <APPLET> but that was not to work.

                      "What --WORKED-- for me at last was:"

                      1. Uninstall Internet Explorer 7.

                      2. Restart System.

                      3. Uninstall Java 1,5 with Update 9(that was installed)

                      4. Install Java version 1.5 with upgrade 5 from the link:

                      http://www.tucows.com/preview/194327

                      5. Then go to Start, Run, type
                      iexplore
                      and hit Enter.

                      Try the sites now.. It works:)

                      6. Then disable update for Java in Control panel. (Also do not update IE or
                      JAVA after that)

                      Hope this help ya all!!!