Howto include JAAS config file in jar-file?

Hello!
I need to get the UserName and Domain from unix/windows workstations my users are working on.
For this task I use JAAS, however it forces me to create my own login-configuration which looks like this:
Test
  //com.sun.security.auth.NTLoginModule sufficient debug=true;
  com.sun.security.auth.module.UnixLoginModule sufficient debug=true;
}; 1.) I have to hard-code the path which is quite ugly, so is it possible to pack this configuration into a jar file and how can I tell JAAS that it can find the configuration INSIDE the jar file?
2.) To use my own configuration is very ugly. I have to if(java.os).... for every configuration because on Linux of course no NTLoginModule is found and vice versa.
It also is quite anoying that the proprietary class names are hard-coded. What if I want to run this on apple or ibm jvm?
Thanks in advance, lg Clemens

I found a solution: simply pass a URL in the property and jaas will load the config-fle from the url!

Similar Messages

  • How to list files from .jar file in applet?

    I have created applet and export all files to .jar file.
    I use File.list() method in applet to list files from one directory and that works ok but if I try to do that from web browser it sends exception AccessDenied meaning that File.list() isn't allowed in browser.
    I know what's the problem but I don't know how to solve it.
    What I want is to read from directory list of files.
    Help anyone?

    I will post here my code so that can be seen what I want to do:
    import java.awt.BorderLayout;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URLClassLoader;
    import java.nio.charset.Charset;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    import javax.swing.JTextPane;
    public class test extends JApplet {
         private static final long serialVersionUID = 1L;
         private JPanel jContentPane = null;
         private JTextPane jTextPane = null;
          * This is the xxx default constructor
         public test() {
              super();
          * This method initializes this
          * @return void
         public void init() {
              this.setSize(449, 317);
              this.setContentPane(getJContentPane());
          * This method initializes jContentPane
          * @return javax.swing.JPanel
         private JPanel getJContentPane() {
              if (jContentPane == null) {
                   jContentPane = new JPanel();
                   jContentPane.setLayout(new BorderLayout());
                   jContentPane.add(getJTextPane(), BorderLayout.CENTER);
              return jContentPane;
          * This method initializes jTextPane     
          * @return javax.swing.JTextPane     
         private JTextPane getJTextPane() {
              if (jTextPane == null) {
                   jTextPane = new JTextPane();
              return jTextPane;
         public void start(){
              File fileDir= new File("somedirectory");
              String strFiles[]= fileDir.list();
              String a="";
              for(int i =0;i<strFiles.length;i++){
                   a=a+strFiles;
              this.jTextPane.setText(a);
    Method init() is irelevant, it just adds JTextPane in applet.
    Method start() is relevant, it runs normaly when started from Eclipse but from browser it sends exception AccessDenied.

  • How to get the class file of jar file

    hello all,
    is there any way to get the class file of jar file,as we have when we compile a java file we get class file
    same do we have any option to get the class file of jar file

    A jar file is a zip archive, so you can uznip it or extract the contents with the command "jar" - if it is what you need.

  • Trying to access the java script files via jar file in WEB SERVER

    hi all,
    I am trying to access the java script files via jar file ,which is present in Apache webserver in order to minimise the number of hits to app server.some thing like cache ...
    in jsp the code goes like this...
         <script type="text/javascript"  archive="http://localhost:14000/dojo.jar!" src="dojo.jar/parser.js" " ></script>{code}
    But i am not able to access the js file which is put in jar file present in the  webserver.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi,
    You can use DWR (Direct Web remoting) for that. It is easy AJAX for java. ou can directly call the java script function from java class and also java class from javaScripts..
    Regards,
    Hardik

  • Since downloading firefoz 4, everytime I make a browser search I get a second page with :"Firefox can't find the file at jar:file://how can I solve the problem. Kindly reply to :ramses1@videotron.ca

    Question
    firefox 4, when I make a browser search I get a second page:"Firefox can't find the file at jar:file:///D:/Program Files/Mozilla Firefox/omni.jar!/chrome/browser/content/browser/<url></url>", how can I solve the problem.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • I upgraded to Firefox 8. Now my home page says this: "Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.jar!/browserconfig.properties.

    This is what it says on my screen when I open Firefox:
    Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.jar!/browserconfig.properties.

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • When searching, I get this message: Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.jar!/chrome/en-US/locale/browser-region/region.propertiesproblems.

    when I enter a word in the search window (the one with the curved arrow at the end), I get this message:
    Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.jar!/chrome/en-US/locale/browser-region/region.propertiesproblems.

    Try the Firefox SafeMode to see how it works there. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    * You can open the Firefox 4/5/6/7 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    If it is good in the Firefox SafeMode, your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes

  • Getting error FF with my extension: cant find the file at jar:file in omni.jar!/chrome/browser/content/browser/ some junk text

    After installing my plugins to ff4 and ff5 I am getting error File not found.
    Firefox can't find the file at jar:file:///Applications/Firefox.app/Contents/MacOS/omni.jar!/chrome/browser/content/browser/%E6%A5%A6%E6%95%AC%E2%BC%BA%E2%BC%AF%E7%8D%95%E7%89%A5%E2%BD%B3%E6%B5%A1%E6%B1%AF%E4%B0%AF%E6%89%A9%E6%85%B2%E7%A5%B2%E4%84%AF%E7%81%B0%E6%A5%AC%E6%85%A3%E6%A5%B4%E6%B9%AF%E3%88%A5%E5%8C%B0%E7%81%B5%E6%BD%B0%E7%91%B2%E4%84%AF%E6%BD%A4%E6%95%A2%E4%8C%AF%E6%B9%AF%E7%89%B4%E6%89%A9%E7%91%B5%E2%95%A5%E3%80%B2%E5%8D%83%E2%B8%B5%E2%BC%B1%E6%BD%83%E6%99%AE%E6%9D%A9%E7%89%B5%E7%91%A1%E6%BD%A9%E2%BD%AE%E4%89%89%E5%91%85%E6%B5%A5%E2%BD%B0%E6%BD%83%E7%91%AE%E6%A5%B2%E7%95%A2%E6%95%B4%E3%84%B6%E3%9C%B8%E3%90%B4%E2%B8%B3%E6%89%A9e%E3%90%B4%E2%B8%B3%E6%89%A9e%08%01%EC%92%B0%E0%B0%BE%EC%92%B8%E0%B0%BE%EC%92%BC%E0%B0%BE%EF%BF%BF%EC%93%80%E0%B0%BE.

    Try:
    "Reset all user preferences to Firefox defaults" on the [[Safe mode]] start window.
    * http://kb.mozillazine.org/Resetting_preferences
    Delete the files extensions.* (extensions.sqlite, extensions.rdf, extensions.cache, extensions.ini) and compatibility.ini in the Firefox [[Profiles|profile folder]] to reset the extensions registry.<br />
    New files will be created when required.
    See "Corrupt extension files":
    * http://kb.mozillazine.org/Unable_to_install_themes_or_extensions
    If you see disabled, not compatible, extensions in "Tools > Add-ons > Extensions" then click the Tools button at the left side of the Search Bar (or click the "Find Updates" button in older Firefox versions) to do a compatibility check or see if there is an update.
    Create a new profile as a test to check if your current profile is causing the problems.
    See:
    * [https://support.mozilla.com/kb/Basic+Troubleshooting#w_8-make-a-new-profile Basic Troubleshooting: Make a new profile]
    If that new profile works then you can transfer some files from the old profile to that new profile (be careful not to copy corrupted files)
    See:
    * http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • How to run .class file and .jar file in jdev9i

    I want to run .class file and .jar file in jdev9i,what should I do?
    Also,I want to generate .class file and .jar file in jdev9i,what should i do?

    Add the .class file containing the public static void main(...) method to the project by clicking on the + toolbar button in the navigator, open the project properties and properly set the additional classpath then right click on the .class in the navigator and say run. It should work, I've just tried it.
    Doesn't work for a .jar yet, in JDeveloper 9.0.3 it works both for .class and .jar
    Michel

  • Including a .jad and a .jar file in presentations

    Hi:
    I did an application using the last version of the Sun Java Wirelless Toolkit 2.5. And now I have a .jad file and a .jar file. I need to include both in a power point presentation to be able to show the application. I dont want to do a link because I'm not gonna use my computer to do the presentation. Do I need to do something special in the deployment step to be able to do this ?
    I have tried to include the program this;
    Insert --> Object
    But it doesn't work.

    Hey listen what you want to do is possible but not in the way you want to do...
    if you want to demonstrate the functionality of your application or how it works then you can use use
    any screen recording software such as: Screen Recorder Gold, Qarbon's Viewlet Builder or ViewletCam
    such software help you to record the activity of screen then you can export the recorded screen shots to multiple formats and include them to your PP presentation...

  • Netbeans 551: Include all libs in project jar file. Possible?

    Is it possible to manually, or automaticly, include the /dist/lib directory into my "GonioLabt,jar" to make it more 'stand alone', file wise.
    Netbeans generates this dist/README.TXT
    ========================
    BUILD OUTPUT DESCRIPTION
    ========================
    When you build an Java application project that has a main class, the IDE
    automatically copies all of the JAR
    files on the projects classpath to your projects dist/lib folder. The IDE
    also adds each of the JAR files to the Class-Path element in the application
    JAR files manifest file (MANIFEST.MF).
    To run the project from the command line, go to the dist folder and
    type the following:
    java -jar "GonioLab.jar"
    To distribute this project, zip up the dist folder (including the lib folder)
    and distribute the ZIP file.
    Notes:
    * If two JAR files on the project classpath have the same name, only the first
    JAR file is copied to the lib folder.
    * If the classpath contains a folder of classes or resources, none of the
    classpath elements are copied to the dist folder.
    * If a library on the projects classpath also has a Class-Path element
    specified in the manifest,the content of the Class-Path element has to be on
    the projects runtime path.
    * To set a main class in a standard Java project, right-click the project node
    in the Projects window and choose Properties. Then click Run and enter the
    class name in the Main Class field. Alternatively, you can manually type the
    class name in the manifest Main-Class element.

    Yes it is possible. The same question has been
    killing me all day. Here is how I did it.
    (I'm on Mac OS 10.4, but this should work anywhere)
    Netbeans produces the following:
    dist/myJar.jar
    dist/lib/swing-layout-1.0.jar
    I would prefer to have only:
    dist/myJar.jar
    But, as you know, myJar.jar requires the class files
    stored in swing-layout-1.0.jar. I unpacked the jar
    files and examined the manifest files. Here is how to
    unpack and repack the jar files into a single jar
    file:
    First, I renamed myJar.jar to myJar.zip and let OS X
    unarchive the jar for me. I did the same for
    swing-layout-1.0.jar.
    I then dropped the MANIFEST.MF file from
    MyJar/META-INF/ into a new folder on my harddrive
    Then, I dropped the package (its a folder full of
    class files) from MyJar/ into the same new folder on
    my harddrive.
    At this point, the new folder contains:
    /newFolder/MANIFEST.MF
    /newFolder/myPackage/
    Then, I grabbed /dist/lib/swing-layout-1.0/org/ and
    dropped that into the new folder.
    We now have in the new folder:
    /newFolder/MANIFEST.MF
    /newFolder/myPackage/
    /newFolder/org/
    Almost done:
    Open the MANIFEST.MF file with a text editor. Mine
    looked like this:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.5
    Created-By: 1.5.0_07-87 ("Apple Computer, Inc.")
    Main-Class: ohm.GUI
    Class-Path: lib/swing-layout-1.0.jar
    X-COMMENT: Main-Class will be added automatically by
    build
    I replaced the ENTIRE contents of the file with
    this:
    Manifest-Version: 1.0
    Main-Class: myPackage/Main
    Where 'myPackage' is the folder containing my class
    files, and 'Main' is the class containing the
    'main(String[] args) method.
    Save the file and we're ready to repack the archive.
    Open the command line (in OS X this is the Terminal)
    I assume the syntax is the same in windoze; Navigate
    to the new folder you created.
    In OSX: cd /newFolder
    in windoze: cd \newFolder
    Then use java's jar command:
    jar cmf MANIFEST.MF MyJar.jar *
    What this does:
    jar is the command. cmf are flags: the 'c' is for
    creating a new jar archive, the 'm' is to specify a
    premade manifest file, the 'f' tells jar to write the
    results to a file. MyJar.jar is the name you have
    chosen for the resulting .jar file. the '*' is a
    wildcard character that tells jar to put every file
    in the present working directory into the new .jar
    Thats it! This produced myJar.jar which worked fine
    by itself, as it included all the classes from
    swing-layout-1.0.jar. It would be a trivial matter to
    write a shell script to do all this for you, unless
    of course you use something silly like windows, in
    which case you'll have to write a batch file or use
    python or something. Good luck, I hope this saves
    others time, drop me a e-mail if this was at all
    confusing! [email protected]
    You should be aware that doing this may well violate the licensing terms for third-party libraries
    By the way, what's silly about using Windows? Are you saying you don't develop for Windows because it's "silly"?

  • How to include images/icons for a jar file

    Hi,
    I need to create a jar file which will contain my application. My source code (.java) files are in "app" folder. I compiled that using javac -d . *.java and one package("appl") was created. I have all icons and images related to my application are in the folder named "icons" in the directory where source files are located i.e; app folder - "app/icons". I am accessing the images in the icons directory as "icons/book.gif".
    I created a jar file from source file directory with the option
    jar cvf app.jar app
    and i added this jar file to my classpath also.
    I have created a batch file to execute this application and set that batch file to "path" environment variable.
    It is running from any directory but no icons are appearing in that application if i try to run the application out side the "app" folder.
    Can any body give suggessions to solve this problem?

    Thanks for the added info, now let's get started.
    To use files in jars, you need to refer to them via a URL, so you'll need to modify your code a little bit first.
    URL imgURL = ClassLoader.getSystemResource("icons/BOOK.gif");
    setIconImage(Toolkit.getDefaultToolkit().getImage(imgURL));Next, you'll need a manifest. Using any text editor such as notepad, create a file called manifest.txt and put two lines in it. The first line will specify the class (w/o .class on the end) that contains your public static void main method, the second line is just an empty line (just press return).
    Main-Class: main
    (a blank line)
    Save this file with your class files (e.g. in Exam folder).
    Next build your jar. We want the jar to contain the package folder and your icon folder as well. So use this:
    jar cmf Exam/manifest.txt myJar.jar Exam/*.class icons
    And you should now have an executable jar. You can run it from dos with:
    java -jar myJar.jar
    or you can double-click it from windows.
    -Ron

  • Include command line args in jar file

    If I make and executable jar file, how can I make it so that when it runs certain comman line arguments are included

    If by "executable jar" you mean that you want to click the jar and run the program (and are using Windows), then you would have to alter the Windows file association for jar files that Java created, adding those options to the javaw command. Note that that would affect all jars that are run this was.
    If you're willing to use the "javaw -jar" command, then just add the options to the javaw command.

  • Firefox won't open, error message"can't find file at jar:file" etc.

    "Firefox cannot find file@jar:file:///program files/Mozilla Firefox/omni jar!/browser config. properties." I tried to download firefox and refreshed the desktop link and still no go. Cannot get firefox to browse.

    Se also:
    *http://kb.mozillazine.org/Preferences_not_saved
    *https://support.mozilla.org/kb/Preferences+are+not+saved
    Create a new profile as a test to check if your current profile is causing the problems.
    See "Basic Troubleshooting: Make a new profile":
    *https://support.mozilla.org/kb/Basic+Troubleshooting#w_8-make-a-new-profile
    There may be extensions and plugins installed by default in a new profile, so check that in "Tools > Add-ons > Extensions & Plugins" in case there are still problems.
    If that new profile works then you can transfer some files from the old profile to that new profile, but be careful not to copy corrupted files.
    See:
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox

  • How to deploy ear file with jar file and war file with different names

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

Maybe you are looking for