Setting PATH and CLASSPATH in Java Applet

Hi,
I have been wondering if there was a way to set the PATH and the CLASSPATH in the HTML file within the <APPLET> tag...
What I would like to do is to read some xml files outside of the directory where my html file is located to run my test application with the configuration on my computer.
(The applet and the html file from which it is called is on my local host.)
Therefore, I have seen that in order to access local files, I have to sign my jar files, which I did.
But the tricky part is that for my test application to work, I need to set the PATH and the CLASSPATH... and I have no idea if this is possible or not...
I have seen that:
*CODEBASE: I specify here the main directory where my jar files are located
*ARCHIVE: I specify here the list of my jar files
In my case:
CODEBASE=../../   (this is the root directory of my whole application)
ARCHIVE=dir/lib/jar1.jar,dir2/jar2.jar,configXML/,etc...I don't know if I can specify the filepath of my xml files (here "configXML") in ARCHIVE (I suspect we can only specify jar files there... right ?)
Maybe I can use ARCHIVE this way to specify my CLASSPATH (and well... not completely the way I would like I suppose), but what about the PATH ?
I have been searching this for soooo long now...
Any help, hint or suggestions (I might doing this all the wrong way...) would be greatly appreciated !
Thanks in advance !

You need to use the code attribute to specify the class that contains the main method to start the application.
<applet code="myPackage.myClass.class" codeBase="http://www.someServer/someFolder/" archive="myApplet.jar">
I hope this solves part of your problem at least.
Andrew

Similar Messages

  • Problem in setting path and classpath for java in RedHat linux 9

    Hi ,
    i am not able to set the PATH and CLASSPATH for j2sdk1.4.2_06
    I have tried with export PATH=$PATH:/usr/j2sdk1.4.2_06/bin
    and export CLASSPATH=$CLASSPATH:/usr/j2sdk1.4.2_06/lib
    in terminal
    but i want to configure it as permenant way for the jre and jdk
    and we should only type java or javac according to the requirement
    regards mihir...

    type those in .bashrc ... save and exit
    then at prompt, type 'source .bashrc'
    this is the permanent solution ...
    bhalo thakun

  • Set path and classpath in ANT

    by using ANT, how can set the JDK path and classpath..
    jdk version exists in the : C:\Program Files\Java\jdk1.6.0
    This is the build.xml that i need to modify!
    -Do i need to have a serperate JAVA_HOME variable?
    <?xml version="1.0"?>
    <!--
    Build file for 'Chat Client'
    Version: $Revision: 4.10 $ $Date: 2003/05/28 $
    Author:  Rajat Gupta
    -->
    <project name="Chat" default="jar" basedir=".">
       <!-- ================================================================== -->
       <!-- Initialization of all property settings                            -->
       <!-- ================================================================== -->
       <target name="init">
          <property name="appname"        value="chat"   />
          <property name="src.dir"        value="src"               />
          <property name="lib.dir"        value="lib"              />
          <property name="build.dir"      value="Chat"            />
          <property name="build.compiler" value="classic"          />
       </target>
       <!-- ================================================================== -->
       <!-- Makes sure the needed directory structure is in place              -->
       <!-- ================================================================== -->
       <target name="prepare" depends="init">
          <mkdir dir="${lib.dir}" />
          <mkdir dir="${lib.dir}/META-INF" />
          <mkdir dir="${build.dir}" />
       </target>
       <!-- ================================================================== -->
       <!-- Compilation of the web part of the application                     -->
       <!-- ================================================================== -->
       <target name="classes" depends="prepare">
          <javac srcdir="${src.dir}/oracle/otnsamples/oc4jjms"
                 destdir="${lib.dir}"
                 includes="**" />
       </target>
       <!-- ================================================================== -->
       <!-- Compilation of the complete J2EE application (both web and EJB)    -->
       <!-- ================================================================== -->
       <target name="j2ee-meta-inf" depends="classes, prepare">
          <copy file="${src.dir}/META-INF/application-client.xml"
                tofile="${lib.dir}/META-INF/application-client.xml" />
          <copy file="${src.dir}/images/oralogo.gif"
                tofile="${lib.dir}/oralogo.gif" />
       </target>
       <target name="jar" depends="j2ee-meta-inf">
       <jar jarfile="${build.dir}/${appname}.jar"
           basedir="${lib.dir}" manifest="${src.dir}/META-INF/MANIFEST.MF"/>
          <delete dir="${lib.dir}" />
       </target>
    </project>Message was edited by:
    jugp

    [url ='http://www.jguru.com/forums/home.jsp?topic=Ant']answer here

  • How to go about Setting PATH and CLASSPATH?

    I have problems compling the helloworldwww in the core programming.the error was:
    Exception in thread "main"java.lang.NoSuchMethodError:main
    my java programs are in c:\program files\java\bin
    My path :
    PATH=C:\WINNT\system32;C:\WINNT;c:\program files\java\bin
    My classpath
    set CLASSPATH=C:\WINNT\system32;C:\WINNT;c:\program files\java\bin.jar;.
    is there any error in my paths, if yes how to i go about setting the path and classpath??Im running on winXP.j2sdk1.4.1_02.

    set CLASSPATH=.;c:\program files\java\bin.jar;c:\program files\java\bin

  • Setting Path and Classpath in Linux environnement

    Hello,
    I use to develop with JAVA under Windows platform,
    now i am using j2sdk under Mandrake 8.0 , i dunno how to set my PATH end Classpath variables, could you show me how?
    Thanks

    Put this in your user's .bashrc file at the end of it.
    JAVA_HOME=/path/to/java/install
    PATH=$PATH:$JAVA_HOME/bin
    export JAVA_HOME PATHAnd buy a book on Unix/Linux.

  • How do I sett path and classpath in win98

    I have downloaded I have tried but it doesn't work...
    I just don't know how to do, almost tried everything (not the
    right way of course)!
    I would really be happy if someone could tell me how to do!

    The installation instructions are supplied with the JDK download. Otherwise, I found them on this site after 1 minute of searching
    http://java.sun.com/j2se/1.4.1/install-windows.html
    Work your way through these, and if you are still having troubles, feel free to post back here with details of the specific problem you have.

  • Path and classpath

    How do i set path and classpath in java? why it is needed

    ramyabaskar wrote:
    How do i set path and classpath in java? why it is neededTypically you do not set these in java.
    You set the path in the operating system shell.
    You set path so you can launch java by just typing java
    instead of having to type the full path to "C:\Program Files\Java\jre6\bin\java.exe".
    You pass the desired classpath to java when you launch java with the classpath option or set it in the operating system shell using the CLASSPATH env.var.

  • Difference between path and classpath

    Difference between path and classpath?

    PATH - set of paths there executables will be found.
    CLASSPATH - set of paths and archives there class files will be found.

  • How to set BO SDK path and classpath in cmd

    Hi,
    I am new to BO sdk .. I am working on BO XIR2 SDK. I need to run the java program using command prompt. In lib directory of the BO SDK, I have jar files.Could anybody let me know how to set the path, classpath related to BO SDK in command prompt?
    Regards,
    Nisha

    Hi Nisha,
    Use like this
    set path=%PATH%;C:\Program Files\Java\jdk1.6.0_30\bin
    set CLASSPATH=%CLASSPATH%;D:\javaprograms\JAR Files\sqljdbc4.jar
    cd C:\Program Files\Java\jdk1.6.0_30\bin
    java happy2
    In  line1 : We are setting the Path
        line2 : We are setting Classpath
        line3 : Navigating to actual execution directory
        line4 : Executing the actual java class file
    Hope this helps!
    Regards,
    Mani

  • How to set path to run a Java program?

    my pc os is win2000 service pack 3.
    cpu is celoron 667mhz
    256 pc133 sdram
    i have done the setting b4 run a java program but no any effect.
    setting as below:
    set path=c:\j2sdk1.4.1_01\bin
    set classpath=c:\j2sdk1.4.1_01\lib
    my java file is store in C:\Java, file name is HelloWorld.java, so when i type:
    C:\>
    C:\>Java\javac HelloWorld.java
    (the screen show me : java\javac not internal or external........")
    and i try again as follow:
    C:>
    C:>\Java>javac HelloWorld.java
    (the screen show : Exception in thread "main" java.lang.NoClassDefFoundError:HelloWorld/java)
    i cant do anymore, who can help me?

    you need to put the CLASSPATH to dir: c:\j2sdk1.4.1_01
    and also to the directory you are working
    For example, you are working in "C:\Myclasses". You need to put:
    set CLASSPATH = C:\j2sk1.4.1_01;C:\Myclasses;
    if you don't put your working directory, java doesn't find your classes
    Try it and luck!

  • Copy and Paste into Java Applet

    I know there have been some posts like this in the paste, but could not find a reasonable explanation.
    JVM 1.4.2_08
    For an unsigned java applet (Swing) I could not copy from a notepad document into my applets JTextField and JTextArea fields.
    JVM 1.5
    For this same applet (Swing) running under 1.5, I could copy and paste from the notepad document into my applets JTextField and JTextArea fields.
    Does anybody know why the difference?
    Is there a way to copy and paste for applets running in the 1.4.2 jvm?
    Thanks.

    I think it must be some security restriction.
    Set a policy for the applet or sign it:
    Set a policy (windows):
    C:\Program Files\Java\j2re****\lib\security\java.policy
    under grant {
         permission java.security.AllPermission;
    this means that you give all permission to all code, if you only want to give permissions for applets
    comming from google you can add the following:
    grant codeBase "http://google.com/-" {
         permission java.security.AllPermission;
    to sign
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post

  • How to set packages and classpath

    Hi,
    I want to know about packages and classpath. I have these questions
    1, If I put a class in a package(work.util) is it necessary to put the java file in the same directory/directory hierarchy as mentioned in the package declaration. I have to compile this class, run it from main method and must be able for other classes to import.
    2. If a package have subpackages(work.util.db) do I have to set the classpath to subdirectory also to run that class.
    3. If a class is in package is it possible to run the class without prefixing the package name. I need to do this in the text editor so that I can run any program by pressing a hot key.
    rgds
    Antony Paul

    1, If I put a class in a package(work.util) is it
    necessary to put the java file in the same
    directory/directory hierarchy as mentioned in the
    package declaration.Strictly speaking, this isn't covered by the spec - it depends on what compiler and ClassLoader you are using. If you're using Sun's JDK, then yes.
    2. If a package have subpackages(work.util.db) do I
    have to set the classpath to subdirectory also to run
    that class. No. You should add the directory above work/util/db to your classpath. You should not add work, or work/util or work/util/db.
    E.g., if your Java files are in C:/MyProject/JavaSrc/work/util/db, and the package name is work.util.db, then you should have C:/MyProject/JavaSrc on your classpath (or have "." (dot) on your classpath, and compile and run from that same directory).
    3. If a class is in package is it possible to run the
    class without prefixing the package name. I need to do
    this in the text editor so that I can run any program
    by pressing a hot key.If you mean "in order to run work.util.db.Main do I need to type java work.util.db.Main, or just java Main", then you do indeed need the fully qualified class name (otherwise, how would the runtime environment know which class you mean? - there could be any number of classes called Main in any class, and it would have to search every directory and subdirectory on your classpath to find them.

  • Changes in security from 7 update 45 to 7 update 51 and problems with Java applet

    Hello,
    After the update (from 7 update 45) to version 7 update 51 we've gotten some problems with a Java Applet as it won't run.
    When changing security settings to "medium" it works, but it would not run under the default "high" setting. This lead me to update the manifest file as follows:
    Manifest-Version: 1.0
    Trusted-Only: true
    Application-Name: MyApplet
    Permissions: all-permissions
    Caller-Allowable-Codebase: www.MySite.com
    In addition to this, I added the <param> tag in the HTML page.
    <applet name="MyApplet" code="MyApplet" archive="MyApplet.jar">
       <param name="permissions" value="all-permissions" />
    </applet>
    The applet is digitally signed with a certificated issued by Verisign.
    It now runs on my system. But I noticed that it also runs if I switch the security setting back to "high", which doesn't make any sense to me.
    I've tried another computer and to the same thing there. Would not run. I switched to "medium" and and the applet worked. Switched back to "high" and it still works.
    I've tried this in both Google Chorme and Internet Explorer 11.
    On a third computer it won't run at all, getting a different error message than on the other two, but still related to permissions/security.
    The console log message is:
            "liveconnect: Security Exception: JavaScript from http://MySite.comn/MyPage.html attempted to access a resource it has no rights to."
    Any ideas what I'm missing or what I need to change to get this beast to run everywhere.

    I tried changing the Caller-Allowable-Codebase to not include "www." and it started giving the the same error message as for the third machine in the test.
    So, I changed Caller-Allowable-Codebase to "*" which made it work on all machines.
    I don't quite understand why it acts differently on different machines, if it's ok with www.MySite.com on one of the the machines, it should be OK on all no?
    I don't see a problem with letting it be "*" but it would be nice to understand what's going on.

  • Setting path and class path help

    I am a complete beginner who is currently starting a cd based tutorial!I have downloaded jdk1.1.6 which is the nearest developement kit to the one used in the tutorial.I use windows 98.When I try to set my path or class path as instructed in the docs, I cannot find any thing in the autoexec file at all.I have opened using notepad/Run and DOS edit but all three open an empty file.Where will I need to set up the path and class paths.My system must run these from somewhere else perhaps due to an update.

    Hi,
    Put the following statements in your autoexec.bat.
    <homepath> = Path of your JDK folder on the drive. e.g. c:\jdk
    SET CLASSPATH=;.;<homepath>\lib\tools.jar; .... continue with other jar files on the same line and seperate the entries by a semicolon.
    SET PATH=C:\WINDOWS\;C:\<homepath>\BIN\;
    This autoexec.bat must be on c:\. i.e. U can open it in notepad by giving c:\autoexec.bat in the File Open Dialog. It is possible for this file to be empty. Simply add the commands on the last line.
    Regards ,
    Karan

  • How do I set it to where the java applets will load up?

    Uhm.. So, I've gotten the 6.0 java, at first the java applets were doing fine and loading up with Firefox. I have checked the java console and it is set for fire fox, yet it's still not loading the applets. Any suggestions on how to fix this problem?

    Your above posted plugins list show that you have the Java plugin.
    Do Java test pages confirm that the Java plugin is working?
    http://www.java.com/en/download/help/testvm.xml - How do I test whether Java is working on my computer? - 1.4.2_xx, 1.5.0, 6.0
    http://www.java.com/en/download/installed.jsp - Verify Java Version

Maybe you are looking for