Solved

Jar and Policy file

Posted on 2004-09-10
9
292 Views
Last Modified: 2008-02-26
Hi All,
      Earlier we used to execute our application using the run.bat file containing the following command:
java -classpath .\lib -D"java.ext.dirs=.\lib"
-Djava.security.policy==client.policy com.sciatl.svt.ui.Login

      Obviously it opens up a dos console which we are trying to avoid in the current release and the only option is to package all the class file in a jar file. With the help of the manifest file i am launching the Login class.

Here is the manifest file:

Manifest-Version: 1.2
Created-By: 1.3.1 (Sun Microsystems Inc.)
Main-Class: com.sciatl.svt.ui.Login
Class-Path: lib/classes12.jar lib/ejb.jar lib/jaas.jar lib/jaxb-rt-1.0-ea.jar lib/jta.jar lib/oc4j.jar lib/oc4jclient.jar

Now i don't know how to specify the client.policy file in my manifest file or can i specify my policy file somewhere?

Kindly let me know if you have any suggestions or ideas.

Thanks & Regards,
Prem.
0
Comment
Question by:PRAC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 6

Expert Comment

by:expertmb
ID: 12024927
0
 
LVL 92

Expert Comment

by:objects
ID: 12024931
don't think you can sorry
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12024982
You can avoid the console window by invoking javaw in stead of java
I don't know the answer about the policy file.
;JOOP!
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:PRAC
ID: 12025085
Even if i use javaw instead of java, when i double click my run.bat the dos console window comes up.
0
 

Author Comment

by:PRAC
ID: 12025187
I am able to ignore the dos window by adding "start" before javaw in my run.bat file. Now my run.bat contains:

start javaw -classpath .\lib -D"java.ext.dirs=.\lib"
-Djava.security.policy==client.policy com.sciatl.svt.ui.Login

Thanks & Regards,
Prem.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12025331
I presume you run on Windows98 or ME : indeed that's a bug.

;JOOP!
0
 

Author Comment

by:PRAC
ID: 12025348
The OS is Windows XP.
0
 
LVL 1

Accepted Solution

by:
helloexpert earned 125 total points
ID: 12026414
try this

i.e, create an entry for the security policy in the manifest file as
Security-Policy=your file path

then in the java code, get the security policy like this

         JarFile jar = new JarFile(path);
          Manifest mfest = jar.getManifest();
          Attributes attr = mfest.getMainAttributes();
          String cp = attr.getValue("Security-Policy");

then use System.setProperty(..) to set the new policy file.

hope that helps.
0
 

Author Comment

by:PRAC
ID: 12033781
I am able to set my policy file using the following line in my Login class:
System.setProperty("java.security.policy", "client.policy");

Thanks to "helloexpert".
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question